@mpxjs/webpack-plugin 2.7.33 → 2.7.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const harmonySpecifierTag = require('webpack/lib/dependencies/HarmonyImportDepen
|
|
|
12
12
|
const NormalModule = require('webpack/lib/NormalModule')
|
|
13
13
|
const EntryPlugin = require('webpack/lib/EntryPlugin')
|
|
14
14
|
const JavascriptModulesPlugin = require('webpack/lib/javascript/JavascriptModulesPlugin')
|
|
15
|
+
const FlagEntryExportAsUsedPlugin = require('webpack/lib/FlagEntryExportAsUsedPlugin')
|
|
15
16
|
const FileSystemInfo = require('webpack/lib/FileSystemInfo')
|
|
16
17
|
const normalize = require('./utils/normalize')
|
|
17
18
|
const toPosix = require('./utils/to-posix')
|
|
@@ -274,6 +275,9 @@ class MpxWebpackPlugin {
|
|
|
274
275
|
errors.push('Multiple MpxWebpackPlugin instances exist in webpack compiler, please check webpack plugins config!')
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
// 将entry export标记为used且不可mangle,避免require.async生成的js chunk在生产环境下报错
|
|
279
|
+
new FlagEntryExportAsUsedPlugin(true, 'entry').apply(compiler)
|
|
280
|
+
|
|
277
281
|
if (this.options.mode !== 'web') {
|
|
278
282
|
// 强制设置publicPath为'/'
|
|
279
283
|
if (compiler.options.output.publicPath && compiler.options.output.publicPath !== publicPath) {
|
|
@@ -116,7 +116,7 @@ module.exports = function (source) {
|
|
|
116
116
|
pluginEntry.pages = []
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
async.eachOf(pages, (page, key) => {
|
|
119
|
+
async.eachOf(pages, (page, key, callback) => {
|
|
120
120
|
processPage(page, context, '', (err, entry) => {
|
|
121
121
|
if (err === RESOLVE_IGNORED_ERR) {
|
|
122
122
|
delete pages[key]
|
|
@@ -133,7 +133,7 @@ module.exports = function (source) {
|
|
|
133
133
|
}
|
|
134
134
|
callback()
|
|
135
135
|
})
|
|
136
|
-
})
|
|
136
|
+
}, callback)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
async.parallel([
|
|
@@ -210,12 +210,11 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
212
|
// 样式类名绑定
|
|
213
|
-
test: /^wx:class$/,
|
|
214
|
-
web ({
|
|
215
|
-
const dir = this.test.exec(name)[1]
|
|
213
|
+
test: /^wx:(class)$/,
|
|
214
|
+
web ({ value }) {
|
|
216
215
|
const parsed = parseMustache(value)
|
|
217
216
|
return {
|
|
218
|
-
name: ':'
|
|
217
|
+
name: ':class',
|
|
219
218
|
value: parsed.result
|
|
220
219
|
}
|
|
221
220
|
}
|
package/lib/wxs/loader.js
CHANGED
|
@@ -2,6 +2,7 @@ const NodeTargetPlugin = require('webpack/lib/node/NodeTargetPlugin')
|
|
|
2
2
|
const EntryPlugin = require('webpack/lib/EntryPlugin')
|
|
3
3
|
const LazySet = require('webpack/lib/util/LazySet')
|
|
4
4
|
const LimitChunkCountPlugin = require('webpack/lib/optimize/LimitChunkCountPlugin')
|
|
5
|
+
const FlagEntryExportAsUsedPlugin = require('webpack/lib/FlagEntryExportAsUsedPlugin')
|
|
5
6
|
const path = require('path')
|
|
6
7
|
const WxsPlugin = require('./WxsPlugin')
|
|
7
8
|
const RecordResourceMapDependency = require('../dependencies/RecordResourceMapDependency')
|
|
@@ -81,7 +82,8 @@ module.exports.pitch = function (remainingRequest) {
|
|
|
81
82
|
new WxsPlugin({ mode }),
|
|
82
83
|
new NodeTargetPlugin(),
|
|
83
84
|
new EntryPlugin(this.context, request, { name: getName(filename) }),
|
|
84
|
-
new LimitChunkCountPlugin({ maxChunks: 1 })
|
|
85
|
+
new LimitChunkCountPlugin({ maxChunks: 1 }),
|
|
86
|
+
new FlagEntryExportAsUsedPlugin(true, 'entry')
|
|
85
87
|
]
|
|
86
88
|
|
|
87
89
|
const childCompiler = this._compilation.createChildCompiler(resourcePath, outputOptions, plugins)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.36",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": ">=14.14.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "5838576bdde0b66664f8121c729143ff4ed0aef4"
|
|
84
84
|
}
|