Skip to content

Commit

Permalink
Fix style compilation for file paths containing webpack template strings
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis committed Dec 2, 2023
1 parent 2755282 commit 9456e13
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/eleven-oranges-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@vanilla-extract/webpack-plugin': patch
---

Fixes a bug that was causing style compilation to fail on paths containing [webpack template strings] such as `[id]`.

[webpack template strings]: https://webpack.js.org/configuration/output/#template-strings
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
}
},
"volta": {
"node": "20.9.0"
"node": "20.9.0",
"pnpm": "8.10.2"
}
}
6 changes: 5 additions & 1 deletion packages/webpack-plugin/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ function compileVanillaSource(
);
const compat = createCompat(isWebpack5);
// Child compiler will compile vanilla-extract files to be evaled during compilation
const outputOptions = { filename: loader.resourcePath };
const outputOptions = {
filename: loader.resourcePath
.replaceAll('[', '[\\')
.replaceAll(']', '\\]'),
};

const compilerName = getCompilerName(loader.resourcePath);
const childCompiler = getRootCompilation(loader).createChildCompiler(
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "ESNEXT" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": ["es2019", "es2017", "dom"],
"lib": ["es2021", "dom"],
"noEmit": true,
"noImplicitAny": true,
"noUnusedLocals": true,
Expand Down

0 comments on commit 9456e13

Please sign in to comment.