Skip to content

Commit

Permalink
fix(webpack-plugin): crash with [email protected] (#2262)
Browse files Browse the repository at this point in the history
  • Loading branch information
AviVahl authored Jan 12, 2022
1 parent ffa4b4a commit df3a4ae
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 46 deletions.
90 changes: 45 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"ts-expect": "^1.3.0",
"typescript": "~4.5.4",
"url-loader": "^4.1.1",
"webpack": "^5.65.0"
"webpack": "^5.66.0"
},
"engines": {
"node": ">=12"
Expand Down
3 changes: 3 additions & 0 deletions packages/webpack-plugin/src/plugin-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function replaceMappedCSSAssetPlaceholders({
if (isLoadedWithKnownAssetLoader(assetModule)) {
return extractFilenameFromAssetModule(assetModule, publicPath);
} else {
const data = new Map<string, unknown>();
const assetModuleSource = assetModule.generator.generate(assetModule, {
chunkGraph,
moduleGraph,
Expand All @@ -116,9 +117,11 @@ export function replaceMappedCSSAssetPlaceholders({
runtimeTemplate,
dependencyTemplates,
type: 'asset/resource',
getData: () => data,
});

if (assetModule.buildInfo.dataUrl) {
// Investigate using the data map from getData currently there is an unknown in term from escaping keeping extractDataUrlFromAssetModuleSource
return extractDataUrlFromAssetModuleSource(
assetModuleSource.source().toString()
);
Expand Down

0 comments on commit df3a4ae

Please sign in to comment.