Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed May 24, 2024
1 parent 829ab14 commit 5002f0b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugin-css-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ResourceInterface } from "@greenwood/cli/src/lib/resource-interface.js"
import * as acornWalk from "acorn-walk";
import * as acorn from "acorn";
import { hashString } from "@greenwood/cli/src/lib/hashing-utils.js";
import { importAttributes } from 'acorn-import-attributes'; // comes from Greenwood
import { importAttributes } from "acorn-import-attributes"; // comes from Greenwood

function getCssModulesMap(compilation) {
const locationUrl = new URL("./__css-modules-map.json", compilation.context.scratchDir);
Expand Down
6 changes: 5 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ function transformConstructableStylesheetsPlugin() {
name: "transform-css-module-scripts",
enforce: "pre",
resolveId: (id, importer) => {
if (importer?.indexOf("/src/components/") >= 0 && id.endsWith(".css") && !id.endsWith(".module.css")) {
if (
importer?.indexOf("/src/components/") >= 0 &&
id.endsWith(".css") &&
!id.endsWith(".module.css")
) {
// add .type so CSS modules are not precessed by the default pipeline
return path.join(path.dirname(importer), `${id}.type`);
}
Expand Down
3 changes: 2 additions & 1 deletion web-test-runner.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default {
};
}
},
}, {
},
{
name: "css-modules",
async transform(context) {
const url = new URL(`.${context.request.url}`, import.meta.url);
Expand Down

0 comments on commit 5002f0b

Please sign in to comment.