2021-04-18

webpack 单文件打包

'use strict';

const path = require('path');

module.exports = {

entry: './src/index.js',

output: {

path: path.join(__dirname, '/dist'),

    filename: 'bundle.js'

},

mode:'production'

}

webpack多文件打包

const path = require('path');

module.exports = {

entry:{

index: './src/index.js',

hello: './src/hello.js'

},

output:{

path:path.join(__dirname, '/dist'),

filename:'[name].js'

},

mode:'production',

module:{

rules:[

{

test:/.js$/,

use:'babel-loader'

}

]

}

}

你可能感兴趣的:(2021-04-18)