@mpxjs/webpack-plugin 2.8.19 → 2.8.21

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.
@@ -328,7 +328,7 @@ function compileScriptSetup (
328
328
  } }`
329
329
  } else {
330
330
  return `${key}: { type: ${propRuntimeTypes.type}${
331
- defaultString ? `, ${defaultString}` : null
331
+ defaultString ? `, ${defaultString}` : ''
332
332
  } }`
333
333
  }
334
334
  }).join(',\n ')}
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 = (issuer && issuer.request && isStyleRequest(issuer.request)) || queryObj.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(newUrl)
413
- : JSON.stringify(newUrl),
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.19",
3
+ "version": "2.8.21",
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": "fca1b61f52c2ed8b3926e7b8a3a150d27904911a"
85
+ "gitHead": "976455b62ed3cd98c7e58d7daca99fd8abb4b5fa"
86
86
  }