How to tell webpack dev server to serve index.html for any route

React router allows react apps to handle /arbitrary/route. In order this to work, I need my server to send the React app on any matched route. But webpack dev server doesn’t handle arbitrary end points. There is a solution here using additional express server. How to allow for webpack-dev-server to allow entry points from react-router … Read more

Error: Cannot find module ‘webpack’

I’m just getting started with webpack and am having difficulty getting the multiple-entry-points sample to build. The webpack.config.js file in the example includes the line var CommonsChunkPlugin = require(“../../lib/optimize/CommonsChunkPlugin”); which fails for me with the error Error: Cannot find module ‘../../lib/optimize/CommonsChunkPlugin’ Searching around, I found other examples of using the CommonsChunkPlugin with the expression var … Read more

What does “The code generator has deoptimised the styling of [some file] as it exceeds the max of “100KB”” mean?

I added a new npm package to my project and require it in one of my modules. Now I get this message from webpack, build modulesNote: The code generator has deoptimised the styling of “D:/path/to/project/node_modules/ramda/dist/ramda.js” as it exceeds the max of “100KB”. What does it mean? Do I need to take some action? 11 Answers … Read more

How to include bootstrap css and js in reactjs app?

I am newb to reactjs, I want to include bootstrap in my react app I have installed bootstrap by npm install bootstrap –save Now, want to load bootstrap css and js in my react app. I am using webpack. webpack.config.js var config = { entry: ‘./src/index’, output: { path: ‘./’, filename: ‘index.js’ }, devServer: { … Read more

Typescript react – Could not find a declaration file for module ”react-materialize’. ‘path/to/module-name.js’ implicitly has an any type

I am trying to import components from react-materialize as – import {Navbar, NavItem} from ‘react-materialize’; But when the webpack is compiling my .tsx it throws an error for the above as – ERROR in ./src/common/navbar.tsx (3,31): error TS7016: Could not find a declaration file for module ‘react-materi alize’. ‘D:\Private\Works\Typescript\QuickReact\node_modules\react-materialize\l ib\index.js’ implicitly has an ‘any’ type. … Read more

Webpack.config how to just copy the index.html to the dist folder

I am trying to automate assets going into /dist. I have the following config.js: module.exports = { context: __dirname + “/lib”, entry: { main: [ “./baa.ts” ] }, output: { path: __dirname + “/dist”, filename: “foo.js” }, devtool: “source-map”, module: { loaders: [ { test: /\.ts$/, loader: ‘awesome-typescript-loader’ }, { test: /\.css$/, loader: “style-loader!css-loader” } … Read more

How to make the webpack dev server run on port 80 and on 0.0.0.0 to make it publicly accessible?

I am new to the whole nodejs/reactjs world so apologies if my question sounds silly. So I am playing around with reactabular.js. Whenever I do a npm start it always runs on localhost:8080. How do I change it to run on 0.0.0.0:8080 to make it publicly accessible? I have been trying to read the source … Read more