2021-04-14 12:50:27 +00:00
|
|
|
const path = require('path')
|
2020-12-24 04:28:17 +00:00
|
|
|
/**
|
|
|
|
* @type {import('vite').UserConfig}
|
|
|
|
*/
|
|
|
|
module.exports = {
|
2021-10-09 10:09:06 +00:00
|
|
|
build: {
|
|
|
|
cssTarget: 'chrome61'
|
|
|
|
},
|
2021-02-11 20:51:21 +00:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': __dirname
|
|
|
|
}
|
2021-01-26 16:30:34 +00:00
|
|
|
},
|
2020-12-24 04:28:17 +00:00
|
|
|
css: {
|
|
|
|
modules: {
|
|
|
|
generateScopedName: '[name]__[local]___[hash:base64:5]'
|
2021-02-15 15:00:13 +00:00
|
|
|
|
|
|
|
// example of how getJSON can be used to generate
|
|
|
|
// typescript typings for css modules class names
|
|
|
|
|
|
|
|
// getJSON(cssFileName, json, _outputFileName) {
|
|
|
|
// let typings = 'declare const classNames: {\n'
|
|
|
|
// for (let className in json) {
|
|
|
|
// typings += ` "${className}": string;\n`
|
|
|
|
// }
|
|
|
|
// typings += '};\n'
|
|
|
|
// typings += 'export default classNames;\n'
|
|
|
|
// const { join, dirname, basename } = require('path')
|
|
|
|
// const typingsFile = join(
|
|
|
|
// dirname(cssFileName),
|
|
|
|
// basename(cssFileName) + '.d.ts'
|
|
|
|
// )
|
|
|
|
// require('fs').writeFileSync(typingsFile, typings)
|
|
|
|
// },
|
2020-12-24 04:28:17 +00:00
|
|
|
},
|
|
|
|
preprocessorOptions: {
|
|
|
|
scss: {
|
2021-05-12 17:28:39 +00:00
|
|
|
additionalData: `$injectedColor: orange;`,
|
|
|
|
importer(url) {
|
|
|
|
if (url === 'virtual-dep') return { contents: '' }
|
|
|
|
}
|
2021-04-14 12:50:27 +00:00
|
|
|
},
|
|
|
|
styl: {
|
|
|
|
additionalData: `$injectedColor ?= orange`,
|
|
|
|
imports: [
|
|
|
|
'./options/relative-import.styl',
|
|
|
|
path.join(__dirname, 'options/absolute-import.styl')
|
|
|
|
]
|
2020-12-24 04:28:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|