Skip to content

Commit

Permalink
fix: inline source maps for TS + split source w/ and w/o into groups (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zamotany authored Aug 13, 2019
1 parent 9f71a69 commit 5fb3e88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Object {
"filename": "[file].map",
"module": true,
"moduleFilenameTemplate": "[absolute-resource-path]",
"test": /\\\\\\.\\(js\\|css\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
"test": /\\\\\\.\\(js\\|jsx\\|css\\|ts\\|tsx\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
},
"sourceMapFilename": "[file].map",
"sourceMappingURLComment": "
Expand Down Expand Up @@ -198,7 +198,7 @@ Object {
"filename": "[file].map",
"module": true,
"moduleFilenameTemplate": "[absolute-resource-path]",
"test": /\\\\\\.\\(js\\|css\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
"test": /\\\\\\.\\(js\\|jsx\\|css\\|ts\\|tsx\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
},
"sourceMapFilename": "[file].map",
"sourceMappingURLComment": "
Expand Down Expand Up @@ -263,7 +263,7 @@ Object {
"filename": "[file].map",
"module": true,
"moduleFilenameTemplate": "[absolute-resource-path]",
"test": /\\\\\\.\\(js\\|css\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
"test": /\\\\\\.\\(js\\|jsx\\|css\\|ts\\|tsx\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
},
"sourceMapFilename": "[file].map",
"sourceMappingURLComment": "
Expand Down Expand Up @@ -418,7 +418,7 @@ Object {
"filename": "[file].map",
"module": true,
"moduleFilenameTemplate": "[absolute-resource-path]",
"test": /\\\\\\.\\(js\\|css\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
"test": /\\\\\\.\\(js\\|jsx\\|css\\|ts\\|tsx\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
},
"sourceMapFilename": "[file].map",
"sourceMappingURLComment": "
Expand Down Expand Up @@ -482,7 +482,7 @@ Object {
"filename": "[file].map",
"module": true,
"moduleFilenameTemplate": "[absolute-resource-path]",
"test": /\\\\\\.\\(js\\|css\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
"test": /\\\\\\.\\(js\\|jsx\\|css\\|ts\\|tsx\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
},
"sourceMapFilename": "[file].map",
"sourceMappingURLComment": "
Expand Down Expand Up @@ -541,7 +541,7 @@ Object {
"filename": "[file].map",
"module": true,
"moduleFilenameTemplate": "[absolute-resource-path]",
"test": /\\\\\\.\\(js\\|css\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
"test": /\\\\\\.\\(js\\|jsx\\|css\\|ts\\|tsx\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
},
"sourceMapFilename": "[file].map",
"sourceMappingURLComment": "
Expand Down Expand Up @@ -648,7 +648,7 @@ Object {
"filename": "[file].map",
"module": true,
"moduleFilenameTemplate": "[absolute-resource-path]",
"test": /\\\\\\.\\(js\\|css\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
"test": /\\\\\\.\\(js\\|jsx\\|css\\|ts\\|tsx\\|\\(js\\)\\?bundle\\)\\(\\$\\|\\\\\\?\\)/i,
},
"sourceMapFilename": "[file].map",
"sourceMappingURLComment": "
Expand Down
10 changes: 6 additions & 4 deletions packages/haul-core/src/preset/utils/getSourceMapPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ export default function getSourceMapPlugin(
serverConfig: NormalizedServerConfig
) {
const baseOptions = {
test: /\.(js|css|(js)?bundle)($|\?)/i,
filename: '[file].map',
moduleFilenameTemplate: '[absolute-resource-path]',
test: /\.(js|jsx|css|ts|tsx|(js)?bundle)($|\?)/i,
module: true,
};

Expand All @@ -21,7 +19,11 @@ export default function getSourceMapPlugin(
publicPath: `http://${serverConfig.host}:${serverConfig.port}/`,
} as webpack.EvalSourceMapDevToolPluginOptions);
} else if (bundleConfig.sourceMap) {
return new webpack.SourceMapDevToolPlugin(baseOptions);
return new webpack.SourceMapDevToolPlugin({
...baseOptions,
filename: '[file].map',
moduleFilenameTemplate: '[absolute-resource-path]',
});
}

return undefined;
Expand Down

0 comments on commit 5fb3e88

Please sign in to comment.