Webpack Express Cannot Resolve Module ‘fs’, Request Dependency is Expression
Just posting an answer, since not everyone reads comments on SO. @Aurora0001 nailed it. Webpack’s config needs to have this set: “target”: “node”
Just posting an answer, since not everyone reads comments on SO. @Aurora0001 nailed it. Webpack’s config needs to have this set: “target”: “node”
You’re using fetch to request a JSON file and that will only happen at runtime. Furthermore, webpack only processes anything that is imported. You expected it to handle an argument to a function, but if webpack did that, every argument to a function would be considered a module and that breaks any other use for … Read more
Solution: load independently compiled Webpack 2 bundles dynamically [closed]
The main problem is with Webpack 5. It doesn’t preload the polyfill of Node.js. I see that this issue can help you. https://github.com/webpack/webpack/issues/11282 To solve it: npm install util, and add it into webpack.config.js: module.exports = { // … resolve: { fallback: { util: require.resolve(“util/”) } } // … };
According to your comments you are using material-ui and react-bootstrap. Those dependencies are bundled by webpack along with your react and react-dom packages. Any time you require or import a package it is bundled as part of your bundle file. And here it comes my guess. You are probably importing the react-bootstrap and material-ui components … Read more
Per this comment, you can add your application source via paths in tsconfig.json: { “compilerOptions”: { …, “baseUrl”: “.”, “paths”: { …, “@app/*”: [“app/*”], “@components/*”: [“components/*”] } } } Then you can import absolutely from app/ or components/ instead of relative to the current file: import {TextInputConfiguration} from “@components/configurations”; Note: baseUrl must be specified if … Read more
For Webpack 5, you can reference process/browser from the appropriate plugins part of webpack.config.js: // webpack needs to be explicitly required const webpack = require(‘webpack’) // import webpack from ‘webpack’ // (if you’re using ESM) module.exports = { /* … rest of the config here … */ plugins: [ // fix “process is not defined” … Read more
In the latest vuejs (as of May 7, 2018), you need to add a “vue.config.js” in the project root directory: vue.config.js: module.exports = { devServer: { open: process.platform === ‘darwin’, host: ‘0.0.0.0’, port: 8085, // CHANGE YOUR PORT HERE! https: true, hotOnly: false, }, } In this file, set the value: https: true
Two things were causing my problems here: module.exports = { entry: ‘./src/index.js’, output: { // For some reason, the `__dirname` was not evaluating and `/public` was // trying to write files to a `public` folder at the root of my HD. path: __dirname + ‘/public’, // Public path refers to the location from the _browser’s_ … Read more