Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(webpack-runner): 同步 2.x 的 sourceMapType 配置项 #6544

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "node",
"request": "launch",
"name": "CLI debug",
"program": "${workspaceFolder}/packages/taro-cli/bin/taro-build",
"program": "${workspaceFolder}/packages/taro-cli/bin/taro",
// "cwd": "${project absolute path}",
// "args": [
// "build",
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-webpack-runner/src/config/dev.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function (appPath: string, config: Partial<BuildConfig>): any {
designWidth = 750,
deviceRatio,
enableSourceMap = true,
sourceMapType,
enableExtract = false,

defineConstants = emptyObj,
Expand Down Expand Up @@ -113,7 +114,7 @@ export default function (appPath: string, config: Partial<BuildConfig>): any {

chain.merge({
mode,
devtool: getDevtool([enableSourceMap]),
devtool: getDevtool({ enableSourceMap, sourceMapType }),
entry,
output: getOutput(appPath, [{
outputRoot,
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-webpack-runner/src/config/prod.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default function (appPath: string, config: Partial<BuildConfig>): any {
designWidth = 750,
deviceRatio,
enableSourceMap = false,
sourceMapType,
enableExtract = true,

defineConstants = emptyObj,
Expand Down Expand Up @@ -132,7 +133,7 @@ export default function (appPath: string, config: Partial<BuildConfig>): any {

chain.merge({
mode,
devtool: getDevtool(enableSourceMap),
devtool: getDevtool({ enableSourceMap, sourceMapType }),
entry,
output: getOutput(appPath, [{
outputRoot,
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-webpack-runner/src/util/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,6 @@ export const getOutput = (appPath: string, [{ outputRoot, publicPath, chunkDirec
}
}

export const getDevtool = enableSourceMap => {
return enableSourceMap ? 'cheap-module-eval-source-map' : 'none'
export const getDevtool = ({ enableSourceMap, sourceMapType = 'cheap-module-eval-source-map' }) => {
return enableSourceMap ? sourceMapType : 'none'
}