@mpxjs/webpack-plugin 2.8.18 → 2.8.20
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.
|
@@ -95,13 +95,19 @@ function compileScriptSetup (
|
|
|
95
95
|
node,
|
|
96
96
|
end
|
|
97
97
|
) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
if (node) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
`[@mpxjs/webpack-plugin script-setup-compiler] ${msg}\n\n${filePath}\n${formatCodeFrame(
|
|
101
|
+
content,
|
|
102
|
+
node.start + startOffset,
|
|
103
|
+
end
|
|
104
|
+
)}`
|
|
105
|
+
)
|
|
106
|
+
} else {
|
|
107
|
+
throw new Error(
|
|
108
|
+
`[@mpxjs/webpack-plugin script-setup-compiler] ${msg}\n\n${filePath}\n`
|
|
109
|
+
)
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
function registerUserImport (
|
|
@@ -600,6 +606,11 @@ function compileScriptSetup (
|
|
|
600
606
|
}
|
|
601
607
|
}
|
|
602
608
|
|
|
609
|
+
// 添加defineExpose强制配置校验
|
|
610
|
+
if (!hasDefineExposeCall) {
|
|
611
|
+
error('Mpx script setup must define the variables for return using defineExpose, see details: https://mpxjs.cn/guide/composition-api/composition-api.html#defineexpose')
|
|
612
|
+
}
|
|
613
|
+
|
|
603
614
|
// import {createComponent} from '@mpxjs/core' 添加是否已有import判断
|
|
604
615
|
const ctor = getCtor(ctorType)
|
|
605
616
|
_s.prependLeft(
|
package/lib/url-loader.js
CHANGED
|
@@ -3,24 +3,15 @@ const mime = require('mime')
|
|
|
3
3
|
const parseRequest = require('./utils/parse-request')
|
|
4
4
|
const getOptions = loaderUtils.getOptions
|
|
5
5
|
|
|
6
|
-
function isStyleRequest (request) {
|
|
7
|
-
const { loaderString, queryObj } = parseRequest(request)
|
|
8
|
-
if (queryObj.type === 'styles') return true
|
|
9
|
-
if (/(css-loader|wxss\/loader)/.test(loaderString)) return true
|
|
10
|
-
return false
|
|
11
|
-
}
|
|
12
|
-
|
|
13
6
|
module.exports = function (src) {
|
|
14
7
|
let transBase64 = false
|
|
15
8
|
const options = Object.assign({}, getOptions(this))
|
|
16
9
|
const { resourcePath, queryObj } = parseRequest(this.resource)
|
|
17
10
|
const mimetype = options.mimetype || mime.getType(resourcePath)
|
|
18
|
-
const moduleGraph = this._compilation.moduleGraph
|
|
19
|
-
const issuer = moduleGraph.getIssuer(this._module)
|
|
20
11
|
const publicPathScope = options.publicPathScope === 'all' ? 'all' : 'styleOnly'
|
|
21
12
|
const limit = options.limit
|
|
22
13
|
const useLocal = !limit || src.length < limit || queryObj.useLocal
|
|
23
|
-
const isStyle =
|
|
14
|
+
const isStyle = queryObj.isStyle
|
|
24
15
|
|
|
25
16
|
if (isStyle) {
|
|
26
17
|
if (options.publicPath) {
|
|
@@ -8,6 +8,8 @@ const {
|
|
|
8
8
|
WEBPACK_IGNORE_COMMENT_REGEXP
|
|
9
9
|
} = require('../utils')
|
|
10
10
|
|
|
11
|
+
const addQuery = require('../../utils/add-query')
|
|
12
|
+
|
|
11
13
|
const isUrlFunc = /url/i
|
|
12
14
|
const isImageSetFunc = /^(?:-webkit-)?image-set$/i
|
|
13
15
|
const needParseDeclaration = /(?:url|(?:-webkit-)?image-set)\(/i
|
|
@@ -404,13 +406,13 @@ const plugin = (options = {}) => {
|
|
|
404
406
|
if (!importName) {
|
|
405
407
|
importName = `___CSS_LOADER_URL_IMPORT_${urlToNameMap.size}___`
|
|
406
408
|
urlToNameMap.set(newUrl, importName)
|
|
407
|
-
|
|
409
|
+
const finalUrl = addQuery(newUrl, { isStyle: true })
|
|
408
410
|
options.imports.push({
|
|
409
411
|
type: 'url',
|
|
410
412
|
importName,
|
|
411
413
|
url: options.resolver
|
|
412
|
-
? options.urlHandler(
|
|
413
|
-
: JSON.stringify(
|
|
414
|
+
? options.urlHandler(finalUrl)
|
|
415
|
+
: JSON.stringify(finalUrl),
|
|
414
416
|
index
|
|
415
417
|
})
|
|
416
418
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.20",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=14.14.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "c330d3938cc0c37843761df8b1f2deb9b6c618fc"
|
|
86
86
|
}
|