Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: false,
parser: require('postcss-comment'),
plugins: [
require('postcss-import'),
require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
]
}
}
// sass 全局变量
const isSass = fs.existsSync(path.resolve(process.env.UNI_INPUT_DIR, 'uni.sass'))
const isScss = fs.existsSync(path.resolve(process.env.UNI_INPUT_DIR, 'uni.scss'))
let sassData = isSass ? getPlatformSass() : getPlatformScss()
if (isSass) {
sassData = `@import "@/uni.sass"`
} else if (isScss) {
sassData = `${sassData}
@import "@/uni.scss";`
}
const scssLoader = {
loader: 'sass-loader',
options: {
sourceMap: false
}
}
const sassLoader = {
}
if (!options.css.loaderOptions.postcss) {
options.css.loaderOptions.postcss = {}
}
if (!options.css.loaderOptions.sass) {
options.css.loaderOptions.sass = {}
}
if (!options.css.loaderOptions.postcss.config) {
options.css.loaderOptions.postcss.config = {}
}
// sass 全局变量
const isSass = fs.existsSync(path.resolve(process.env.UNI_INPUT_DIR, 'uni.sass'))
const isScss = fs.existsSync(path.resolve(process.env.UNI_INPUT_DIR, 'uni.scss'))
let sassData = isSass ? getPlatformSass() : getPlatformScss()
if (isSass) {
sassData = `@import "@/uni.sass"`
} else if (isScss) {
sassData = `${sassData}
@import "@/uni.scss";`
}
if (sassLoaderVersion < 8) {
options.css.loaderOptions.sass.data = sassData
} else {
options.css.loaderOptions.sass.prependData = sassData
}
let userPostcssConfigPath = path.resolve(process.env.UNI_INPUT_DIR, 'postcss.config.js')
if (fs.existsSync(userPostcssConfigPath)) {