@mpxjs/webpack-plugin 2.7.58 → 2.7.59
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/loader.js
CHANGED
|
@@ -18,15 +18,17 @@ const AppEntryDependency = require('./dependencies/AppEntryDependency')
|
|
|
18
18
|
const RecordResourceMapDependency = require('./dependencies/RecordResourceMapDependency')
|
|
19
19
|
const RecordVueContentDependency = require('./dependencies/RecordVueContentDependency')
|
|
20
20
|
const CommonJsVariableDependency = require('./dependencies/CommonJsVariableDependency')
|
|
21
|
+
const tsWatchRunLoaderFilter = require('./utils/ts-loader-watch-run-loader-filter')
|
|
21
22
|
const { MPX_APP_MODULE_ID } = require('./utils/const')
|
|
22
23
|
const path = require('path')
|
|
23
24
|
|
|
24
25
|
module.exports = function (content) {
|
|
25
26
|
this.cacheable()
|
|
26
27
|
|
|
27
|
-
// 兼容处理处理ts-loader中watch-run/updateFile逻辑,直接跳过当前loader及后续的
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// 兼容处理处理ts-loader中watch-run/updateFile逻辑,直接跳过当前loader及后续的loader返回内容
|
|
29
|
+
const pathExtname = path.extname(this.resourcePath)
|
|
30
|
+
if (!['.vue', '.mpx'].includes(pathExtname)) {
|
|
31
|
+
this.loaderIndex = tsWatchRunLoaderFilter(this.loaders, this.loaderIndex)
|
|
30
32
|
return content
|
|
31
33
|
}
|
|
32
34
|
|
package/lib/selector.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
const parseComponent = require('./parser')
|
|
2
2
|
const parseRequest = require('./utils/parse-request')
|
|
3
|
+
const tsWatchRunLoaderFilter = require('./utils/ts-loader-watch-run-loader-filter')
|
|
4
|
+
const path = require("path");
|
|
3
5
|
|
|
4
6
|
module.exports = function (content) {
|
|
5
7
|
this.cacheable()
|
|
6
|
-
|
|
8
|
+
const pathExtname = path.extname(this.resourcePath)
|
|
9
|
+
if (!['.vue', '.mpx'].includes(pathExtname)) {
|
|
10
|
+
this.loaderIndex = tsWatchRunLoaderFilter(this.loaders, this.loaderIndex)
|
|
11
|
+
return content
|
|
12
|
+
}
|
|
7
13
|
// 移除mpx访问依赖,支持 thread-loader
|
|
8
14
|
const { mode, env } = this.getOptions() || {}
|
|
9
15
|
if (!mode && !env) {
|
|
@@ -4,7 +4,7 @@ module.exports = function (loaderContext) {
|
|
|
4
4
|
let entryName = ''
|
|
5
5
|
for (const [name, { dependencies }] of loaderContext._compilation.entries) {
|
|
6
6
|
const entryModule = moduleGraph.getModule(dependencies[0])
|
|
7
|
-
if (entryModule.resource === loaderContext.resource) {
|
|
7
|
+
if (entryModule && entryModule.resource === loaderContext.resource) {
|
|
8
8
|
entryName = name
|
|
9
9
|
break
|
|
10
10
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const normalize = require('./normalize')
|
|
2
|
+
const selectorPath = normalize.lib('selector.js')
|
|
3
|
+
const scriptSetupPath = normalize.lib('script-setup-compiler/index.js')
|
|
4
|
+
const mpxLoaderPath = normalize.lib('loader.js')
|
|
5
|
+
const { has } = require('./set')
|
|
6
|
+
|
|
7
|
+
const tsLoaderWatchRunFilterLoaders = new Set([
|
|
8
|
+
selectorPath,
|
|
9
|
+
scriptSetupPath,
|
|
10
|
+
mpxLoaderPath,
|
|
11
|
+
'node_modules/vue-loader/lib/index.js'
|
|
12
|
+
])
|
|
13
|
+
|
|
14
|
+
module.exports = (loaders, loaderIndex) => {
|
|
15
|
+
for (let len = loaders.length; len > 0; --len) {
|
|
16
|
+
const currentLoader = loaders[len - 1]
|
|
17
|
+
if (!has(tsLoaderWatchRunFilterLoaders, filterLoaderPath => currentLoader.path.endsWith(filterLoaderPath))) {
|
|
18
|
+
break
|
|
19
|
+
}
|
|
20
|
+
loaderIndex--
|
|
21
|
+
}
|
|
22
|
+
return loaderIndex
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.59",
|
|
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": "92ab578c176f5c4439f40d2eb045b01e95a98038"
|
|
84
84
|
}
|