1
1
1thater2020-08-13 10:19:03
webpack
1thater, 2020-08-13 10:19:03

Why does everything stop working when importing a module?

Everything stops working when I import the module. (does not display errors in the console)

* everything stops working if it is written in the config *

optimization: {
  splitChunks: {
  chunks: 'all'
  }
},


config itself
const path = require('path');
// const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

const isDev = process.env.NODE_ENV === 'development';

module.exports = {
  context: path.resolve(__dirname, 'src'),
  entry: {
    main:[
      '@babel/polyfill', 
      './common.js'
    ],
    shelkAndMoz:[
      '@babel/polyfill', 
      './mozShel.js'
    ],
    global:[
      '@babel/polyfill', 
      './index.js'
    ],
  },
  output: {
    filename: '[name].bundle.js',
    // filename: '[name].[hash].js',
    path: path.resolve(__dirname, 'dist'),
    publicPath: '/dist'
  },
  devServer: {
    port: 4040,
    hot: isDev
  },
  devtool: isDev ? 'source-map': '',
  plugins: [
    new CleanWebpackPlugin()
  ],
  resolve: {
    extensions: ['.js'],
    alias: {
      '@modules': path.resolve(__dirname, 'src/modules'),
      '@diplom_light': path.resolve(__dirname, 'diplom_light'),
    }
  },
  // optimization: {
  // 	splitChunks: {
  // 		chunks: 'all'
  // 	}
  // },
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: '/node_modules/',
        options: {
          presets: [
            '@babel/preset-env'
          ],
          plugins: [

          ]
        }
      }
    ]
  }
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Polina Titova, 2020-08-13
@poly-titova

webpack. Full course 2020

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question