re: 0cjs! Webpack4 tutorial: Building React app without config file. VIEW POST

TOP OF THREAD FULL DISCUSSION
re: webpack-dev-middleware + webpack-dev-server + server.js: ... app.use(webpackDevMiddleware(compiler, { publicPath: config.output.publicPath }));...
 

Sorry to reply late.
If your webpack.config.js doesn't have 'mode' property, you have to add 'mode' property into your webpack.config.js.

The below is an example.

module.exports = {
  mode: 'production', // <= It is necessary to resolve the warning
  entry: {
    'index': [
      path.resolve(__dirname, 'src/index.js')
    ]
  },
  output: {
    filename: '[name].js',
    path: path.resolve(__dirname, 'public'),
    publicPath: '/',
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
    })
  ],
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        use: 'babel-loader',
      },
    ]
  },
  resolve: {
    extensions: ['.js', '.jsx'],
  },
};

Thank you for reading this post.

 

Hello, Masashi Hirano.

It's seems im miss something in the past, here is examples ) github.com/webpack/webpack/tree/ma...

Anyway, thx ) for response.

code of conduct - report abuse