dev 环境 不分割代码
This commit is contained in:
parent
31bdb54319
commit
05b2a156f6
|
|
@ -20,6 +20,8 @@ const {
|
|||
} = require('./env');
|
||||
const isDev = NODE_ENV === 'development';
|
||||
|
||||
// process.env.OAK_PLATFORM: wechatMp | wechatPublic | web | node
|
||||
|
||||
const relativeFileLoader = (ext = '[ext]') => {
|
||||
return {
|
||||
loader: 'file-loader',
|
||||
|
|
@ -107,7 +109,8 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
include: /oak-general-business\/wechatMp|oak-general-business\\wechatMp/,
|
||||
include:
|
||||
/oak-general-business\/wechatMp|oak-general-business\\wechatMp/,
|
||||
type: 'javascript/auto',
|
||||
use: [
|
||||
oakFileLoader('wxss'),
|
||||
|
|
@ -163,7 +166,8 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
test: /\.(xml|wxml)$/,
|
||||
include: /oak-general-business\/wechatMp|oak-general-business\\wechatMp/,
|
||||
include:
|
||||
/oak-general-business\/wechatMp|oak-general-business\\wechatMp/,
|
||||
type: 'javascript/auto',
|
||||
use: [
|
||||
oakFileLoader('wxml'),
|
||||
|
|
@ -181,11 +185,13 @@ module.exports = {
|
|||
new OakWeChatMpPlugin({
|
||||
exclude: ['*/weui-miniprogram/*'],
|
||||
include: ['project.config.json', 'sitemap.json'],
|
||||
split: !isDev,
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
__DEV__: isDev,
|
||||
__WECHAT__: true,
|
||||
['process.env.NODE_ENV']: JSON.stringify(NODE_ENV),
|
||||
['process.env.OAK_PLATFORM']: 'wechatMp',
|
||||
}),
|
||||
// new MiniCssExtractPlugin({ filename: `[name]${PLATFORM_CONFIG[yamlConfig.platform].style}` }),
|
||||
new StylelintPlugin({
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class OakWeChatMpPlugin {
|
|||
commonsChunkName: 'commons',
|
||||
vendorChunkName: 'vendor',
|
||||
runtimeChunkName: 'runtime',
|
||||
split: true,
|
||||
},
|
||||
options
|
||||
);
|
||||
|
|
@ -148,6 +149,7 @@ class OakWeChatMpPlugin {
|
|||
}
|
||||
|
||||
async setAppEntries(compiler) {
|
||||
const { split } = this.options;
|
||||
this.npmComponents = new Set();
|
||||
this.oakPages = new Set();
|
||||
this.oakComponents = new Set();
|
||||
|
|
@ -156,7 +158,9 @@ class OakWeChatMpPlugin {
|
|||
this.addScriptEntry(compiler),
|
||||
this.addAssetsEntries(compiler),
|
||||
]);
|
||||
this.applyPlugin(compiler);
|
||||
if (split) {
|
||||
this.applyPlugin(compiler);
|
||||
}
|
||||
}
|
||||
|
||||
// resolve tabbar page compoments
|
||||
|
|
|
|||
Loading…
Reference in New Issue