当我使用webpack 4拆分js文件时,然后我得到dist目录,其中包含:app.js,vendor.js和另外一个js文件名vendor〜app.js,它怎么来以及为什么出现?
以下是这些文件:
这是我的webpack配置:
CREATE MATERIALIZED VIEW MV_DATA
BUILD IMMEDEATE
REFRESH FAST START WITH (SYSDATE) NEXT (TRUNC(SYSDATE) + 1) + 6 / 24 WITH ROWID
ON COMMIT
DISABLE QUERY REWRITE
AS SELECT * FROM YOURTABLE
在我的entry.js中:
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
mode: 'production',
entry: {
vendor: ['react', 'react-dom', 'redux', 'react-redux', 'react-router-dom'],
app: './src/entry.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
chunkFilename: '[name].js',
publicPath: '/',
filename: '[name].js'
},
module: {
rules: [
{
test: /\.js[x]?$/,
exclude: /node_modules/,
include: path.resolve(__dirname, 'src'),
use: [{
loader: 'babel-loader',
options: {
cacheDirectory: true,
babelrc: false,
presets: [['@babel/preset-env', {
"modules": false
}], '@babel/preset-react'],
plugins: ['@babel/plugin-transform-runtime', "@babel/plugin-proposal-class-properties"]
}
}]
},
]
},
optimization: {
runtimeChunk: {
name: 'manifest'
},
splitChunks: {
minChunks: 1,
minSize: 2,
chunks: 'all',
name: true,
cacheGroups: {
common: {
test: 'vendor',
chunks: 'initial',
name: 'vendor',
enforce: true,
}
}
}
},
plugins: [
new CleanWebpackPlugin(['dist']),
]
}
答案 0 :(得分:0)
从入口点删除供应商。即使在语义上也是错误的。
这些文件名旨在防止代码重复。 如果您有真正的第二个入口点:anotheApp.js,您将有两个选择加载到页面上:
将每个包装放到自己的口袋中
this.platform.ready().then((readySource) => {
let filter = {
box: 'inbox', // 'inbox' (default), 'sent', 'draft', '' for all
indexFrom: 0, // start from index 0
maxCount: 3, // count of SMS to return each time
};
if (SMS) SMS.listSMS(filter, (ListSms) => {
let messages = ListSms;
console.log(messages);
,
Error => {
alert(JSON.stringify(Error))
});
});