12345678910111213141516171819202122232425262728293031323334353637 |
- const path = require('path');
- // node写法
- module.exports = {
- mode: 'production',
- entry: "./src/index.js",
- // entry: ['./src/a.js','./src/index.js']
- // entry: {
- // hi:'./src/a.js',
- // hello:'./src/index.js'
- // }
- output: {
- // filename: '[name]-[id]-[hash].js',
- path: path.resolve(__dirname, 'dist'),
- clean: true,
- },
- module: {
- rules: [
- {
- test: /\.css$/i,
- use: ['style-loader', 'css-loader'],
- }, {
- test: /\.(png|svg|jpg|jpeg|gif)$/i,
- type: 'asset/resource',
- },
- {
- test: /\.m?js$/,
- exclude: /(node_modules|bower_components)/,
- use: {
- loader: 'babel-loader',
- options: {
- presets: ['@babel/preset-env'],
- },
- },
- },
- ]
- }
- }
|