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

Module build failed {filename} is not part of the compilation at Angular 5.0.0 #8296

Closed
kenneth-igaw opened this issue Nov 2, 2017 · 3 comments

Comments

@kenneth-igaw
Copy link

kenneth-igaw commented Nov 2, 2017

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

angular: "5.0.0"
angular/cli: "1.5.0-rc.8"
ngtools/webpack: "1.8.0-rc.8"

Repro steps.

webpack building with AngularCompilerPlugin

The log given by the failure.

Module build failed: Error: {filename} is not part of the compilation.

Desired functionality.

Mention any other details that might be useful.

Hello.

I am trying to update angular v5.0.0 released yesterday.

But the error is occurred when i try to compile with AngularCompilerPlugin plugin.

The webpack throws an error as

Module build failed {filename} is not part of the compilation
// ex) filename => app.main.ts

my tsconfig.json is as follows

// tsconfig.json
{
  "version": "1.0.0",
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noImplicitAny": false,
    "removeComments": false,
    "suppressImplicitAnyIndexErrors": false,
    "strictNullChecks": false,
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "lib": [
    "dom",
    "dom.iterable",
    "es2015",
    "scripthost"
  ],
  "exclude": [
    "node_modules",
    "Content/scripts/app.aot",
    "Content/scripts/app/typings",
    "Content/scripts/app/app.main.aot.ts",
    "Content/homeworks"
  ]
}

And this is my AngularCompilerPlugin option

new AngularCompilerPlugin ({
    tsConfigPath: rootDir + '/tsconfig.json',
    entryModule: contentDir + '/scripts/app/app.module#AppModule'
}),

Other webpack configuration is not changed.

And everything worked well until I replaced the AotPlugin.

So I tried to fix the plugin's code directly to fix the problem.

And there's one question in this process,

If there is no key in object, it will exist as undefined.

In compiler_host.ts, Why does stats compare to null ?

const stats = this._files[fileName];
if (stats == null) {
    ....
}

I changed above code as follows for quickfix the issue

const stats = this._files[fileName];
if (!stats) {
    ....
}

It's worked, However i think it is not the best practice.

@KennethanCeyer
Copy link

I will put a comment with my personal account to check the progress of the issue.

@filipesilva
Copy link
Contributor

Hello, this issue is a duplicate of #8284 (comment). You'll find more information there about what this error means.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants