Skip to content

Getting the error (Emitted value instead of an instance of Error) Cannot find source file 'compiler.es5.ts' after ejecting webpack.config.js #7115

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

Closed
maxkoretskyi opened this issue Jul 24, 2017 · 8 comments

Comments

@maxkoretskyi
Copy link

maxkoretskyi commented Jul 24, 2017

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.2.1
node: 6.9.5
os: win32 x64

Repro steps.

$ ng new somerepo
$ cd somerepo
$ npm i
$ ng eject
$ npm start

The log given by the failure.

WARNING in /@angular/compiler/@angular/compiler.es5.js
(Emitted value instead of an instance of Error) Cannot find source file 'compiler.es5.ts': Error: Can't resolve './compiler.es5.ts' in 'D:\Projects\innovation-studio-packages\packages\innovation-studio\node_modules@angular\compi
ler@angular'
@ ./~/@angular/platform-browser-dynamic/@angular/platform-browser-dynamic.es5.js 7:0-72
@ ./src/main.ts
@ multi (webpack)-dev-server/client?http://localhost:4200 ./src/main.ts

Desired functionality.

No errors

Mention any other details that might be useful.

@christianscharr
Copy link
Contributor

christianscharr commented Jul 26, 2017

This seems to be related to the "source-map-loader" where the exclude-statement via regex doesnt work properly...
You can fix this by manually by editing the ejected webpack.config.json

"module": {
    "rules": [
      {
        "enforce": "pre",
        "test": /\.js$/,
        "loader": "source-map-loader",
        "exclude": [
          // instead of /\/node_modules\//
          path.join(process.cwd(), 'node_modules')
        ]
      },

Can you confirm this solves your problem? Will prepare an pull-request for this then...

Seems related to #6870

@abhijeet1403
Copy link

@christianscharr Thanks, works perfect for me! 👍

@Roaders
Copy link

Roaders commented Nov 28, 2017

I am still getting this error on @angular/cli version 1.4.5 (@angular/compiler version 4.3.6):

WARNING in ./node_modules/@angular/compiler/@angular/compiler.es5.js
(Emitted value instead of an instance of Error) Cannot find source file 'compiler.es5.ts': Error: Can't resolve './compiler.es5.ts' in 'C:\folderName\src\node_modules\@angular\compiler\@angular'
 @ ./node_modules/@angular/platform-browser-dynamic/@angular/platform-browser-dynamic.es5.js 7:0-72
 @ ./main/main.ts
 @ multi (webpack)-dev-server/client?http://localhost.ms.com:4100 ./main/main.ts

looking in the relevant folder I only see js files in there, there are no ts files...

@zakdances
Copy link

zakdances commented Dec 23, 2017

I'm also still getting this error. I'm using

    "@angular/cli": "^1.6.2",
    "@angular/compiler": "^5.1.2",
    "@angular/compiler-cli": "^5.1.2",

In my case, it seems to be triggered by a font resource:

WARNING in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
(Emitted value instead of an instance of Error) postcss-url: /Users/zakdances/projects/MyProject/web/site/MyProject/src/styles.scss:4:3: Can't read file'/Users/zakdances/projects/MyProject/web/site/MyProject/src/assets/fonts/My%20Font%20Medium%20Condensed%20Italic.otf', ignoring
NonErrorEmittedError: (Emitted value instead of an instance of Error) postcss-url: /Users/zakdances/projects/MyProject/web/site/MyProject/src/styles.scss:4:3: Can't read file '/Users/zakdances/projects/MyProject/web/site/MyProject/src/assets/fonts/My%20Font%20Medium%20Condensed%20Italic.otf', ignoring
    at Object.emitWarning (/Users/zakdances/projects/MyProject/web/site/MyProject/node_modules/webpack/lib/NormalModule.js:117:16)
    at result.warnings.forEach (/Users/zakdances/projects/MyProject/web/site/MyProject/node_modules/postcss-loader/lib/index.js:149:49)
    at Array.forEach (<anonymous>)
    at postcss.process.then (/Users/zakdances/projects/MyProject/web/site/MyProject/node_modules/postcss-loader/lib/index.js:149:27)
    at <anonymous>
 @ ./src/styles.scss 4:14-191
 @ multi ./src/styles.scss ./src/app/theme-1.scss

@hansl hansl added freq2: medium severity2: inconvenient and removed effort1: easy (hours) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Feb 1, 2018
@hansl hansl unassigned Brocco Feb 1, 2018
@junibrosas
Copy link

junibrosas commented Feb 26, 2018

In my case, looks like the package ngx-quill has problems with its source maps so exclude the package instead of excluding the whole node_modules.

@m4ss1m0g
Copy link

m4ss1m0g commented Aug 3, 2018

I had the same problem with Reflect.ts.
Module Warning (from ./node_modules/source-map-loader/index.js):; (Emitted value instead of an instance of Error) Cannot find source file 'Reflect.ts': Error: Can't resolve './Reflect.ts'

I solved with @christianscharr solution.

@clydin
Copy link
Member

clydin commented Sep 28, 2018

eject functionality is no longer available in the latest version (6.x+). For custom webpack configurations the following unofficial add-on is a suggested solution: https://github.com/manfredsteyer/ngx-build-plus

@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 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests