Skip to content
Advertisement

Tag: webpack

webpack dynamic module loader by require

OK, i have searched high and low but cannot reliably deterrmine if this is or is not possible with webpack. https://github.com/webpack/webpack/tree/master/examples/require.context Appears to indicate that one can pass a string to a function and it load a module… But my attempt is just not working: webpack.config.js The server.js The module in modules/ named test.js But the result is always the

Exclude var and json file from webpack build

I’m trying to exclude but retain external reference to a few JSON files from a webpack build. I’ve modified the webpack.config.js to include: This solved some previous errors, but now it seems that the ‘font’ var is being considered undefined. The error is referring to this line in the build, where webpack has exported the ‘font’ var as a module.export:

Can’t set NODE_ENV=production with npm and webpack

I’m trying to access process.env.NODE_ENV inside my app, but I only get process is not defined when I check it. package.json: webpack.config.js: const NODE_ENV = process.env.NODE_ENV ? process.env.NODE_ENV.toLowerCase() : ‘development’; and below : In the app source: And it seems that process is not defined… What am I doing wrong here? Answer I’m not totally sure if the problem came

Function from external JS file not being called

I am using webpack and firebase. I have this line in my package.json > “start”: “webpack-dev-server ./index.js”, In my index.js file I have function In my index.html file I have this line > <input type=”submit” onclick=logUserIn() value=”Log in”> When I click that button I get this error > Uncaught ReferenceError: logUserIn is not defined I also have this line in

How to disable ESLint in vue-cli?

How do I go about disabling ESlint in project generated with vue-cli? If I remove the loader: ‘eslint’ line it won’t compile, same with setting it to an empty string. I know I can opt out of ESLint during the initialization phase, but how can I disable it after my project has been created? Answer Vue’s starter projects are themselves

How to load image files with webpack file-loader

I am using webpack to manage a reactjs project. I want to load images in javascript by webpack file-loader. Below is the webpack.config.js: I used this line to load image files and copy them to dist/public/icons directory and keep the same file name. But I have two problems when using it. When I run webpack command, the image file was

Webpack-dev-server not bundling even after showing bundle valid message

I’ve set up a basic react application with webpack but I couldn’t get the webpack-dev-server running properly. I’ve installed webpack-dev-server globally and tried running the command sudo webpack-dev-server –hot as hot reloading was required. The project seems to be working fine with just webpack cmd. It builds into my build folder and I can get it working via some server

Advertisement