代码拉取完成,页面将自动刷新
const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const fs = require('fs');
// 拿出commonjs模块
const nodeModules = {};
fs.readdirSync('node_modules')
.filter( (catalogue) => {
return ['.bin'].indexOf(catalogue) === -1;
})
.forEach( (mod) => {
nodeModules[mod] = 'commonjs ' + mod;
});
module.exports = {
// mode: 'development',
mode: 'production',
entry: './src/index.js',
target: 'node',
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'lib'),
libraryTarget: 'commonjs2',
},
externals: nodeModules,
node: {
__filename: false,
__dirname: false,
path: 'empty',
fs: 'empty',
child_process: 'empty',
},
optimization: {
minimize: true,
},
context: __dirname,
module: {
noParse: /node-ssh/,
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
node: true,
},
},
],
],
},
},
{
loader: 'eslint-loader',
options: {
formatter: require('eslint-friendly-formatter')
}
}
],
},
],
},
plugins: [new CleanWebpackPlugin()],
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。