Skip to content

Commit

Permalink
fix: issue with regexp chars in multi file component files
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Aug 18, 2020
1 parent d518872 commit 64224c3
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 5 deletions.
71 changes: 67 additions & 4 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": {
"base-x": "^3.0.7",
"concat-with-sourcemaps": "^1.1.0",
"escape-string-regexp": "^4.0.0",
"lasso-modules-client": "^2.0.5",
"loader-utils": "^1.4.0",
"sort-keys": "^4.0.0",
Expand Down
3 changes: 2 additions & 1 deletion src/loader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as path from "path";
import { Compiler } from "webpack";
import * as loaderUtils from "loader-utils";
import ConcatMap from "concat-with-sourcemaps";
import escapeRegExp from "escape-string-regexp";
import getAssetCode from "./get-asset-code";
import { getVirtualModules } from "../shared/virtual";
import pluginOptionsForCompiler from "../shared/plugin-options-for-compiler";
Expand Down Expand Up @@ -292,7 +293,7 @@ function getMissingDepRequire(resource: string, meta): string | false {
if (missingDeps.length) {
const templateFileName = getBasenameWithoutExt(resource);
return `require.context(".", false, /\\${path.sep}${
templateFileName === "index" ? "" : `${templateFileName}\\.`
templateFileName === "index" ? "" : `${escapeRegExp(templateFileName)}\\.`
}(?:${missingDeps.join("|")})\\.[^\\${path.sep}]+$/)`;
}

Expand Down

0 comments on commit 64224c3

Please sign in to comment.