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

webpack config node miss #11458

Closed
BennieMeng opened this issue Jul 5, 2018 · 7 comments
Closed

webpack config node miss #11458

BennieMeng opened this issue Jul 5, 2018 · 7 comments

Comments

@BennieMeng
Copy link

Module not found: Error: Can't resolve 'fs' in '/home/mengqingyun/iserver/src/frontend/node_modules/yamljs/lib'.
when i run my product on dev model, i find this issue.
so we add this to your config:
node: {
fs: "empty"
}.
but with lastest version of angular-cli@6.0.7. i can't find entry to add this config.
under is part of my angular.json:
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "frontend:build"
},
"configurations": {
"production": {
"browserTarget": "frontend:build:production"
}
}
}

so i try to read resource fo @angular-devkit/build-angular .
browser, find node is false.

if change to fs: “empty”. problem is solved.
alse i find other config file all set node like webpack.config.common.js
node: {
fs: 'empty',
global: true,
crypto: 'empty',
tls: 'empty',
net: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}

@Plysepter
Copy link

I am experiencing this issue as well and I hope it can be resolved but I also believe that this might be a duplicate of this issue here: #10681

@filipesilva
Copy link
Contributor

I'm sorry to say but this is expected behaviour. You can read more about why we disabled these imports in #9827.

@BennieMeng
Copy link
Author

@filipesilva i get it because of environment . but i'd like to find an entry to write config like setting node config. i not find it in scema.json page. can you help me where override webpack config. thank you~

@liuxh0
Copy link

liuxh0 commented Aug 14, 2018

Hi @filipesilva , I can understand why node modules are disabled. But most of npm packages those import or require nodejs modules don't work any more. Do you have a workaround?

@Plysepter
Copy link

@liuxh0 while not an official solution you can try this package (not mine) https://github.com/meltedspark/angular-cli-builders. It allows you to extend the angular cli webpack config. You take the risk of future updates being incompatible but gain the ability to obtain the flexibility you are looking for. The Angular CLI team has been fantastic about making the cli modular and this package takes advantage of this.

@liuxh0
Copy link

liuxh0 commented Aug 16, 2018

@Plysepter Thanks for your advice. I've solved by problem by adding browser field in package.json. But I still hope Angular lets user modify webpack config, just like tsconfig.json and tslint.json.

@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants