Cannot find module ‘webpack/bin/config-yargs’

Getting error when running webpack-dev-server –config config/webpack.dev.js –progress –profile –watch –content-base src/. Here is the error log: module.js:442 throw err; ^ Error: Cannot find module ‘webpack/bin/config-yargs’ at Function.Module._resolveFilename (module.js:440:15) at Function.Module._load (module.js:388:25) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3) 31 Answers … Read more

How to create multiple output paths in Webpack config

Does anyone know how to create multiple output paths in a webpack.config.js file? I’m using bootstrap-sass which comes with a few different font files, etc. For webpack to process these i’ve included file-loader which is working correctly, however the files it outputs are being saved to the output path i specified for the rest of … Read more

I am getting an “Invalid Host header” message when connecting to webpack-dev-server remotely

I am using as an environment, a Cloud9.io ubuntu VM Online IDE and I have reduced by troubleshooting this error to just running the app with Webpack dev server. I launch it with: webpack-dev-server -d –watch –history-api-fallback –host $IP –port $PORT $IP is a variable that has the host address $PORT has the port number. … Read more

Field ‘browser’ doesn’t contain a valid alias configuration

I’ve started using webpack2 (to be precise, v2.3.2) and after re-creating my config I keep running into an issue I can’t seem to solve I get (sorry in advance for ugly dump): ERROR in ./src/main.js Module not found: Error: Can’t resolve ‘components/DoISuportIt’ in ‘[absolute path to my repo]/src’ resolve ‘components/DoISuportIt’ in ‘[absolute path to my … Read more

How to build minified and uncompressed bundle with webpack?

Here’s my webpack.config.js var webpack = require(“webpack”); module.exports = { entry: “./entry.js”, devtool: “source-map”, output: { path: “./dist”, filename: “bundle.min.js” }, plugins: [ new webpack.optimize.UglifyJsPlugin({minimize: true}) ] }; I’m building with $ webpack In my dist folder, I’m only getting bundle.min.js bundle.min.js.map I’d also like to see the uncompressed bundle.js 14 Answers 14

ES6 exporting/importing in index file

I am currently using ES6 in an React app via webpack/babel. I am using index files to gather all components of a module and export them. Unfortunately, that looks like this: import Comp1_ from ‘./Comp1.jsx’; import Comp2_ from ‘./Comp2.jsx’; import Comp3_ from ‘./Comp3.jsx’; export const Comp1 = Comp1_; export const Comp2 = Comp2_; export const … Read more

The create-react-app imports restriction outside of src directory

I am using create-react-app. I am trying to call an image from my public folder from a file inside my src/components. I am receiving this error message. ./src/components/website_index.js Module not found: You attempted to import ../../public/images/logo/WC-BlackonWhite.jpg which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either … Read more