标签:资源 插件 port 命名 loader none 文件夹 one 兼容
module.exports = {
entry: './path/to/my/entry/file.js'
};
const path = require('path'); // Node.js 核心模块,用于操作文件路径。
module.exports = {
entry: './path/to/my/entry/file.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'my-first-webpack.bundle.js'
}
};
const path = require('path');
module.exports = {
output: {
filename: 'my-first-webpack.bundle.js'
},
module: {
rules: [ // 打包前处理
{
test: /\.txt$/, // 标识出应该被对应的 loader 进行转换的某个或某些文件 ,正则
use: 'raw-loader' // 表示进行转换时,应该使用哪个 loader
}
]
}
};
const HtmlWebpackPlugin = require('html-webpack-plugin'); // 通过 npm 安装后,引入
const webpack = require('webpack'); // 用于访问内置插件
module.exports = {
module: {
rules: [
{ test: /\.txt$/, use: 'raw-loader' }
]
},
plugins: [
new HtmlWebpackPlugin({template: './src/index.html'})
]
};
module.exports = {
mode: 'production'
};
标签:资源 插件 port 命名 loader none 文件夹 one 兼容
原文地址:https://www.cnblogs.com/qq3279338858/p/11317986.html