Skip to content

Commit

Permalink
fix: 修复 babel options 的 sourceType 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucifier129 committed Sep 27, 2024
1 parent d93dd15 commit 3e5d893
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion build/createWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ module.exports = async function createWebpackConfig(options, isServer = false) {
...config.babel(isServer, config),
// Save disk space when time isn't as important
cacheCompression: isProd,
compact: isProd
compact: isProd,
sourceType: 'unambiguous',
}

result = Object.assign(result, {
Expand Down
6 changes: 5 additions & 1 deletion build/setupDevEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ exports.setupServer = async function setupServer(config, options) {
return runCode(sourceCode)
}

return require(modulePath)
let moduleFilePath = require.resolve(modulePath, {
paths: [outputDir],
})

return require(moduleFilePath)
}


Expand Down
10 changes: 10 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ module.exports = function getConfig(options) {
customConfig = customConfig.default || customConfig
break
}

Object.assign(config, customConfig)

if (config.useBabelRuntime) {
try {
require.resolve('@babel/runtime/package.json')
} catch (error) {
console.error('please install @babel/runtime first, or set useBabelRuntime to false in imvc.config.js file')
process.exit(1)
}
}

return config
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-imvc",
"version": "2.10.24",
"version": "2.10.26",
"description": "An Isomorphic MVC Framework",
"main": "./index",
"bin": {
Expand Down

0 comments on commit 3e5d893

Please sign in to comment.