Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass compiler instead of compilation to findPlugin #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dreef3
Copy link

@dreef3 dreef3 commented Oct 31, 2017

Otherwise causes the following error, webpack@3:

Module build failed: TypeError: Cannot read property 'options' of undefined
    at Object.findPlugin (node_modules/ngc-webpack/src/webpack-wrapper.js:27:20)
    at Object.aotCleanLoader (node_modules/ngc-webpack/src/aot-clean-transformer/loader/text-based-loader/loader.js:184:44)
    at Object.aotCleanLoader (node_modules/ngc-webpack/src/aot-clean-transformer/loader/index.js:15:51)

@dreef3 dreef3 closed this Oct 31, 2017
@dreef3 dreef3 reopened this Oct 31, 2017
@dreef3
Copy link
Author

dreef3 commented Oct 31, 2017

@shlomiassaf It says An error occurred while generating the build script. on Travis, no idea how to fix this...

@shlomiassaf
Copy link
Owner

@dreef3 can you elaborate a bit more on the issue?

@dreef3
Copy link
Author

dreef3 commented Oct 31, 2017

@shlomiassaf,

The comment above is the error from Travis CI, somehow the build doesn't start at all.

The issue that I'm trying to fix in this PR is reproduced with setup from README on webpack@3. It appears that loaders pass compilation instead of compiler object to function findPlugin. Compared with code in webpack-wrapper.js itself:

https://github.com/shlomiassaf/ngc-webpack/blob/master/src/webpack-wrapper.ts#L43
https://github.com/shlomiassaf/ngc-webpack/blob/master/src/aot-clean-transformer/loader/text-based-loader/loader.ts#L238

@shlomiassaf
Copy link
Owner

@dreef3
Something doesn't fit.

  1. there's a Typescript change you did which is not related to webpack...

  2. the project is based on webpack 2, you did not update the package.json files so it still runs on webpack 2 which ofcourse fails with changes for wabpack 3.

  3. Webpack 2 is still widely used, a change must be backward compatible.

@dreef3
Copy link
Author

dreef3 commented Oct 31, 2017

  1. It looks like ts.updateProperty accepts 7 arguments instead of 6 since typescript 2.5:
function updateProperty(node: PropertyDeclaration, decorators: ReadonlyArray<Decorator> | undefined, modifiers: ReadonlyArray<Modifier> | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertyDeclaration;

https://github.com/Microsoft/TypeScript/blob/v2.5.3/lib/typescript.d.ts#L3141

Maybe its better to add typescript <= 2.4 to peerDependencies instead.

  1. I checked Compilation source on 2.x branch and now I think that the change is backward compatible in the sense that the same bug should've appeared with webpack@2 too as there's no plugins property on Compilation:
    https://github.com/webpack/webpack/blob/v2.7.0/lib/Compilation.js#L50
    https://github.com/webpack/webpack/blob/v3.8.1/lib/Compilation.js#L53

I'm not sure what causes the build in Travis to fail. There're no logs related to the project itself. I executed npm run ci locally and it passed (that's when I discovered p.1 above)

@dreef3 dreef3 closed this Oct 31, 2017
@dreef3 dreef3 reopened this Oct 31, 2017
@shlomiassaf
Copy link
Owner

@dreef3 Due to changes in angular 5 i'v refactor the while library.
There are no transformers anymore...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants