搭建 Webpack 开发环境
项目地址:https://github.com/LuckyChou710/ReStart-FE/tree/main/webpack-demo
React dev
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const htmlWebpackPlugin = new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../public/index.html'),
});
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, '../src/index.js'),
output: {
path: path.resolve(__dirname, '../build'),
filename: 'js/[name].[hash].bundle.js',
},
module: {
rules: [
{
test: /\.(mjs|js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
],
},
plugins: [htmlWebpackPlugin],
resolve: {
extensions: ['.mjs', '.js', '.jsx'],
},
};React prod
Vue dev
Vue prod
package.json
Last updated
Was this helpful?