Skip to content

Commit

Permalink
Merge pull request #1472 from cwyyue/fix-mid-cwy
Browse files Browse the repository at this point in the history
fix: mid 加前缀_,class不支持数字开头
  • Loading branch information
hiyuki authored May 13, 2024
2 parents 03e4d75 + 69cb670 commit dcf6b51
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/webpack-plugin/lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = function (content) {
const loaderContext = this
const isProduction = this.minimize || process.env.NODE_ENV === 'production'
const filePath = this.resourcePath
const moduleId = ctorType === 'app' ? MPX_APP_MODULE_ID : mpx.pathHash(filePath)
const moduleId = ctorType === 'app' ? MPX_APP_MODULE_ID : '_' + mpx.pathHash(filePath)

const parts = parseComponent(content, {
filePath,
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-plugin/lib/native-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ module.exports = function (content) {
if (appName) this._module.addPresentationalDependency(new AppEntryDependency(resourcePath, appName))
}

const moduleId = ctorType === 'app' ? MPX_APP_MODULE_ID : mpx.pathHash(filePath)
const moduleId = ctorType === 'app' ? MPX_APP_MODULE_ID : '_' + mpx.pathHash(filePath)

if (ctorType !== 'app') {
rulesRunnerOptions.mainKey = pagesMap[resourcePath] ? 'page' : 'component'
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-plugin/lib/style-compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function (css, map) {
const cb = this.async()
const { resourcePath, queryObj } = parseRequest(this.resource)
const mpx = this.getMpx()
const id = queryObj.moduleId || queryObj.mid || mpx.pathHash(resourcePath)
const id = queryObj.moduleId || queryObj.mid || '_' + mpx.pathHash(resourcePath)
const appInfo = mpx.appInfo
const defs = mpx.defs
const mode = mpx.mode
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-plugin/lib/template-compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function (raw) {
const hasComment = queryObj.hasComment
const isNative = queryObj.isNative
const hasScoped = queryObj.hasScoped
const moduleId = queryObj.moduleId || mpx.pathHash(resourcePath)
const moduleId = queryObj.moduleId || '_' + mpx.pathHash(resourcePath)

let optimizeRenderLevel = 0
for (const rule of optimizeRenderRules) {
Expand Down

0 comments on commit dcf6b51

Please sign in to comment.