-
Notifications
You must be signed in to change notification settings - Fork 29
/
vite.config.ts
51 lines (49 loc) · 1.41 KB
/
vite.config.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import {readFileSync} from 'fs';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import svgLoader from 'vite-svg-loader';
import { fileURLToPath } from 'url';
import { replaceCodePlugin } from 'vite-plugin-replace';
import { generateScopedName } from './build/namespaced-classname.js';
import dts from 'vite-plugin-dts';
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url).pathname).toString());
// https://vitejs.dev/config/
export default () => {
return defineConfig({
plugins: [
vue(),
svgLoader(),
replaceCodePlugin({
replacements: [
{
from: '%POLARIS_VERSION%',
to: pkg.polaris_version,
},
],
}),
dts({
rollupTypes: true,
outDir: 'dist/types',
}),
],
resolve: {
alias: {
'@icons': fileURLToPath(new URL('node_modules/@shopify/polaris-icons/dist/svg', import.meta.url)),
'@polaris': fileURLToPath(new URL('./polaris/polaris-react/src', import.meta.url)),
'@': fileURLToPath(new URL('./src', import.meta.url)),
'~': fileURLToPath(new URL('./node_modules', import.meta.url)),
},
dedupe: ['vue'],
},
css: {
preprocessorOptions: {
scss: {
quietDeps: true, // Silent the deprecation warning
},
},
modules: {
generateScopedName,
},
},
});
};