-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed resolve dir for css chunks #146
- Loading branch information
Showing
8 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as esbuild from 'esbuild'; | ||
import { sassPlugin, postcssModules } from '../../../lib/index.js'; | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path'; | ||
|
||
await fs.rm('dist', { recursive: true, force: true }); | ||
|
||
await esbuild.build({ | ||
entryPoints: ['./src/index.js'], | ||
format: 'esm', | ||
target: ['esnext'], | ||
outdir: 'dist', | ||
sourcemap: true, | ||
bundle: true, | ||
loader: { | ||
'.svg': 'dataurl', | ||
}, | ||
plugins: [ | ||
sassPlugin({ | ||
filter: /\.module\.scss$/, | ||
transform: postcssModules({}), | ||
precompile(source, pathname) { | ||
const basedir = path.dirname(pathname); | ||
return source.replace(/(url\(['"]?)(\.\.?\/)([^'")]+['"]?\))/g, `$1${basedir}/$2$3`); | ||
}, | ||
}), | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "node build.js" | ||
}, | ||
"dependencies": { | ||
"esbuild": "^0.19.2", | ||
"esbuild-sass-plugin": "^2.13.0", | ||
"postcss": "^8.4.29", | ||
"postcss-modules": "^6.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Repro: resolving `url()` with esbuild-sass-plugin | ||
|
||
To reproduce the issue, run: | ||
|
||
``` | ||
npm install | ||
npm run build | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.close { | ||
background-image: url('./close.svg'); | ||
background-repeat: no-repeat; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import styles from './icons.module.scss' | ||
|
||
console.log(styles) |