| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- const path = require("path")
- const HtmlWebpackPlugins = require("html-webpack-plugin")
- // node写法
- module.exports = {
- // development 开发
- // production 生产
- // mode: 'production',
- // entry: "./demo.js"
- // entry: ['./src/a.js', './demo.js']
- // entry: {
- // hi: './src/a.js',
- // hello: './src/b.js'
- // }
- entry: './src/a.js',
- // output: {
- // filename: 'xxx.js',
- // clean: true,
- // path: path.resolve(__dirname, 'news')
- // }
- module: {
- rules: [
- {
- test: /\.css$/i,
- use: ['style-loader', 'css-loader'],
- },
- {
- test: /\.(png|svg|jpg|jpeg|gif)$/i,
- type: 'asset/resource',
- },
- ],
- },
- plugins: [new HtmlWebpackPlugins()],
- devtool: 'inline-source-map',
- performance: {
- maxAssetSize: 100000,
- }
- }
- // 打包命令:yarn webpack
- // yarn webpack serve
- // yarn webpack serve --open
- // png jpg jpeg gif svg 区别
|