@mpxjs/webpack-plugin 2.7.27 → 2.7.33
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
|
@@ -958,6 +958,8 @@ class MpxWebpackPlugin {
|
|
|
958
958
|
if (mpx.mode === 'wx') {
|
|
959
959
|
const dep = new DynamicEntryDependency(request, 'export', '', queryObj.root, MPX_CURRENT_CHUNK, context, range)
|
|
960
960
|
parser.state.current.addPresentationalDependency(dep)
|
|
961
|
+
// 包含require.async的模块不能被concatenate,避免DynamicEntryDependency中无法获取模块chunk以计算相对路径
|
|
962
|
+
parser.state.module.buildInfo.moduleConcatenationBailout = 'require async'
|
|
961
963
|
} else {
|
|
962
964
|
const range = expr.range
|
|
963
965
|
const dep = new CommonJsAsyncDependency(request, range)
|
|
@@ -60,7 +60,7 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
60
60
|
const resourceName = path.join(parsed.dir, parsed.name)
|
|
61
61
|
|
|
62
62
|
if (!outputPath) {
|
|
63
|
-
if (ext === '.js' && resourceName.includes('node_modules')) {
|
|
63
|
+
if (ext === '.js' && resourceName.includes('node_modules') && mode !== 'web') {
|
|
64
64
|
let root = info.descriptionFileRoot
|
|
65
65
|
let name = 'nativeComponent'
|
|
66
66
|
if (info.descriptionFileData) {
|
|
@@ -78,7 +78,7 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
78
78
|
outputPath = getOutputPath(resourcePath, 'component')
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
if (ext === '.js') {
|
|
81
|
+
if (ext === '.js' && mode !== 'web') {
|
|
82
82
|
resource = `!!${nativeLoaderPath}!${resource}`
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -116,7 +116,7 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
116
116
|
outputPath = /^(.*?)(\.[^.]*)?$/.exec(relative)[1]
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
if (ext === '.js') {
|
|
119
|
+
if (ext === '.js' && mode !== 'web') {
|
|
120
120
|
resource = `!!${nativeLoaderPath}!${resource}`
|
|
121
121
|
}
|
|
122
122
|
const entry = getDynamicEntry(resource, 'page', outputPath, tarRoot, publicPath + tarRoot)
|
|
@@ -14,8 +14,8 @@ module.exports = function (css, map) {
|
|
|
14
14
|
this.cacheable()
|
|
15
15
|
const cb = this.async()
|
|
16
16
|
const { resourcePath, queryObj } = parseRequest(this.resource)
|
|
17
|
-
const id = queryObj.moduleId || queryObj.mid
|
|
18
17
|
const mpx = this.getMpx()
|
|
18
|
+
const id = queryObj.moduleId || queryObj.mid || 'm' + mpx.pathHash(resourcePath)
|
|
19
19
|
const appInfo = mpx.appInfo
|
|
20
20
|
const defs = mpx.defs
|
|
21
21
|
const mode = mpx.mode
|
|
@@ -24,7 +24,7 @@ module.exports = function (raw) {
|
|
|
24
24
|
const hasComment = queryObj.hasComment
|
|
25
25
|
const isNative = queryObj.isNative
|
|
26
26
|
const hasScoped = queryObj.hasScoped
|
|
27
|
-
const moduleId = queryObj.moduleId
|
|
27
|
+
const moduleId = queryObj.moduleId || 'm' + mpx.pathHash(resourcePath)
|
|
28
28
|
|
|
29
29
|
const warn = (msg) => {
|
|
30
30
|
this.emitWarning(
|
package/lib/web/processScript.js
CHANGED
|
@@ -119,6 +119,7 @@ module.exports = function (script, {
|
|
|
119
119
|
content += ` import '@mpxjs/webpack-plugin/lib/runtime/base.styl'
|
|
120
120
|
import Vue from 'vue'
|
|
121
121
|
import VueRouter from 'vue-router'
|
|
122
|
+
import Mpx from '@mpxjs/core'
|
|
122
123
|
Vue.use(VueRouter)
|
|
123
124
|
global.getApp = function(){}
|
|
124
125
|
global.getCurrentPages = function(){
|
|
@@ -160,9 +161,8 @@ module.exports = function (script, {
|
|
|
160
161
|
i18n.mergeLocaleMessage(locale, newMessages[locale])
|
|
161
162
|
})
|
|
162
163
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}\n`
|
|
164
|
+
Mpx.i18n = i18n
|
|
165
|
+
\n`
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
// 注入wxs模块
|
package/lib/wxml/loader.js
CHANGED
|
@@ -17,13 +17,10 @@ module.exports = function (content) {
|
|
|
17
17
|
const externals = mpx.externals
|
|
18
18
|
|
|
19
19
|
const { queryObj } = parseRequest(this.resource)
|
|
20
|
-
const moduleId = queryObj.moduleId
|
|
21
20
|
const hasScoped = false
|
|
22
21
|
const hasComment = false
|
|
23
22
|
const isNative = true
|
|
24
23
|
|
|
25
|
-
const usingComponents = []
|
|
26
|
-
|
|
27
24
|
const mode = mpx.mode
|
|
28
25
|
const localSrcMode = queryObj.mode
|
|
29
26
|
const customAttributes = options.attributes || mpx.attributes || []
|
|
@@ -90,8 +87,6 @@ module.exports = function (content) {
|
|
|
90
87
|
hasScoped,
|
|
91
88
|
hasComment,
|
|
92
89
|
isNative,
|
|
93
|
-
moduleId,
|
|
94
|
-
usingComponents,
|
|
95
90
|
isStatic: true
|
|
96
91
|
}
|
|
97
92
|
requestString = getRequestString('template', { src, mode: localSrcMode }, extraOptions)
|
package/lib/wxs/loader.js
CHANGED
|
@@ -22,7 +22,7 @@ module.exports.pitch = function (remainingRequest) {
|
|
|
22
22
|
let { resourcePath, queryObj } = parseRequest(this.resource)
|
|
23
23
|
const issuer = moduleGraph.getIssuer(this._module)
|
|
24
24
|
const { resourcePath: issuerResourcePath, queryObj: issuerQueryObj } = parseRequest(queryObj.issuerResource || issuer.resource)
|
|
25
|
-
const issuerPackageName = issuerQueryObj.packageRoot ||
|
|
25
|
+
const issuerPackageName = issuerQueryObj.packageRoot || 'main'
|
|
26
26
|
const pagesMap = mpx.pagesMap
|
|
27
27
|
const componentsMap = mpx.componentsMap[issuerPackageName]
|
|
28
28
|
const staticResourcesMap = mpx.staticResourcesMap[issuerPackageName]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.33",
|
|
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": "c1d2e39bcfef9bf20484dcbb301381b86a5939e6"
|
|
84
84
|
}
|