Skip to content

Commit 6d0cc68

Browse files
committed
2.2.16
1 parent 1943f2c commit 6d0cc68

File tree

6 files changed

+17
-875
lines changed

6 files changed

+17
-875
lines changed

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
node-version: 16
1616
registry-url: https://registry.npmjs.org/
1717
- run: |
18-
npm install --audit=false --fund=false
18+
npm install --audit=false --fund=false --package-lock=false
1919
npm test
2020
npm publish
2121
env:

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
- uses: actions/setup-node@v2
2626
with:
2727
node-version: 16
28+
registry-url: https://registry.npmjs.org/
2829
- run: |
29-
npm install --audit=false --fund=false
30+
npm install --audit=false --fund=false --package-lock=false
3031
npm test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
node_modules
33
.DS_Store
44
dist
5+
package-lock.json

lib/plugin.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const BuildCache = require('./cache.js');
2525
*/
2626
const buildCssModulesJs = async ({ fullPath, options, build }) => {
2727
const cssFileName = path.basename(fullPath); // e.g. xxx.module.css?esbuild-css-modules-plugin-building
28-
const { buildId } = build.context;
28+
const { buildId, relative } = build.context;
2929
const resolveDir = path.dirname(fullPath);
3030
const classPrefix = path.basename(fullPath, path.extname(fullPath)).replace(/\./g, '-') + '__';
3131
const originCss = await readFile(fullPath);
@@ -34,7 +34,7 @@ const buildCssModulesJs = async ({ fullPath, options, build }) => {
3434
* @type {import('@parcel/css').BundleOptions}
3535
*/
3636
const bundleConfig = {
37-
filename: fullPath,
37+
filename: relative(fullPath), // use relative path to keep hash stable in different machines
3838
code: originCss,
3939
minify: false,
4040
sourceMap: true,
@@ -318,7 +318,9 @@ const onEnd = async (build, options, result) => {
318318
const r = (p) => path.relative(absOutdir, p).split(path.sep).join(path.posix.sep);
319319
const imports = `import "./${r(entryPath)}";\nexport * from "./${r(entryPath)}";`;
320320
if (sourcemap === 'external') {
321-
await appendFile(entryPath, `\n//# sourceMappingURL=${r(entryPath)}.map`, { encoding: 'utf8' });
321+
await appendFile(entryPath, `\n//# sourceMappingURL=${r(entryPath)}.map`, {
322+
encoding: 'utf8'
323+
});
322324
} else if (publicPath && sourcemap) {
323325
const fixedPublicPath = publicPath.endsWith('/') ? publicPath : publicPath + '/';
324326
const entryContent = await readFile(entryPath, { encoding: 'utf8' });

0 commit comments

Comments
 (0)