Skip to content

Commit

Permalink
2.2.16
Browse files Browse the repository at this point in the history
  • Loading branch information
indooorsman committed Apr 24, 2022
1 parent 1943f2c commit 6d0cc68
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 875 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: |
npm install --audit=false --fund=false
npm install --audit=false --fund=false --package-lock=false
npm test
npm publish
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: |
npm install --audit=false --fund=false
npm install --audit=false --fund=false --package-lock=false
npm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules
.DS_Store
dist
package-lock.json
8 changes: 5 additions & 3 deletions lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const BuildCache = require('./cache.js');
*/
const buildCssModulesJs = async ({ fullPath, options, build }) => {
const cssFileName = path.basename(fullPath); // e.g. xxx.module.css?esbuild-css-modules-plugin-building
const { buildId } = build.context;
const { buildId, relative } = build.context;
const resolveDir = path.dirname(fullPath);
const classPrefix = path.basename(fullPath, path.extname(fullPath)).replace(/\./g, '-') + '__';
const originCss = await readFile(fullPath);
Expand All @@ -34,7 +34,7 @@ const buildCssModulesJs = async ({ fullPath, options, build }) => {
* @type {import('@parcel/css').BundleOptions}
*/
const bundleConfig = {
filename: fullPath,
filename: relative(fullPath), // use relative path to keep hash stable in different machines
code: originCss,
minify: false,
sourceMap: true,
Expand Down Expand Up @@ -318,7 +318,9 @@ const onEnd = async (build, options, result) => {
const r = (p) => path.relative(absOutdir, p).split(path.sep).join(path.posix.sep);
const imports = `import "./${r(entryPath)}";\nexport * from "./${r(entryPath)}";`;
if (sourcemap === 'external') {
await appendFile(entryPath, `\n//# sourceMappingURL=${r(entryPath)}.map`, { encoding: 'utf8' });
await appendFile(entryPath, `\n//# sourceMappingURL=${r(entryPath)}.map`, {
encoding: 'utf8'
});
} else if (publicPath && sourcemap) {
const fixedPublicPath = publicPath.endsWith('/') ? publicPath : publicPath + '/';
const entryContent = await readFile(entryPath, { encoding: 'utf8' });
Expand Down
Loading

0 comments on commit 6d0cc68

Please sign in to comment.