Update to Angular v6 – Module not found: Error: Can’t resolve ‘fs’

Since previous answers are quite old, it might help to highlight here that a workaround for Angular9 is just to add the following in your package.json: “browser”: { “fs”: false, “os”: false, “path”: false } This works very well for me. For reference, I found this solution on the official tensorflow/tfjs Github page here.

React + webpack: ‘process.env’ is undefined

In your webpack config, there are two options that can affect process.env: When you specify config.target (see config.target) When you define the process.env variable via DefinePlugin Looking at your code, it looks like process.env might be undefined when both options.prerender and options.minimize are false. You could fix this by always using an environment that defines … Read more

Webpack: After installing webpack and webpack-cli still getting error when running webpack

Seems that you had installed globally only webpack and not webpack-cli. Therefore, npm install -g webpack-cli solves the issue. Explanation and alternative solutions: Why there is the problem in the first place? The following indicates that both webpack and webpack-cli packages are locally installed: I have the latest versions of webpack installed: “webpack”: “^4.0.0”, “webpack-cli”: … Read more

webpack sass-loader not generating a css file

You are using the style-loader, which, by default, embeds your CSS in Javascript and injects it at runtime. If you want real CSS files instead of CSS embedded in your Javascript, you should use the ExtractTextPlugin. A basic config would be: Add var ExtractTextPlugin = require(‘extract-text-webpack-plugin’); to the top of your Webpack config file. Add … Read more

webpack ts-loader error : loaderContext.getOptions is not a function

There is one more way to solve the problem, in addition to upgrading your webpack to webpack 5, as Ali Bigdeli’s answer pointed out. You can also just downgrade ts-loader to 8.2.0. Using your package manager of choice, that might look like: npm install ts-loader@~8.2.0 As pointed out in the Github question linked by Ali … Read more