-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathbuild.mjs
34 lines (29 loc) · 930 Bytes
/
build.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import esbuild from 'esbuild'
import {sassPlugin, postcssModules} from '../../../lib/index.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
import utils from '../utils.js'
const {cleanFixture, logFailure, logSuccess} = utils
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
cleanFixture(__dirname)
// plugins are matched in order so you have to put the most specific patterns (/\.module\.scss$/) first
// followed by the less specific (note that not having specified a filter the default is /\.(s[ac]ss|css)$/)
esbuild.build({
entryPoints: ['src/main.js'],
outdir: 'out',
bundle: true,
format: 'esm',
plugins: [
sassPlugin({
filter: /\.module\.scss$/,
transform: postcssModules({
localsConvention: 'camelCaseOnly'
}),
type: 'css'
}),
sassPlugin({
type: 'lit-css'
})
]
}).then(logSuccess, logFailure)