12345678910111213141516171819202122232425262728293031323334 |
- const path = require('path')
- const webpack = require('webpack')
- const config = {
- parser: require('postcss-comment'),
- css: {
- loaderOptions: {
- less: {
- javascriptEnabled: true
- }
- }
- },
- plugins: [
- require('postcss-import')({
- resolve (id, basedir, importOptions) {
- if (id.startsWith('~@/')) {
- return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
- } else if (id.startsWith('@/')) {
- return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
- } else if (id.startsWith('/') && !id.startsWith('//')) {
- return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
- }
- return id
- }
- }),
- require('autoprefixer')({
- remove: process.env.UNI_PLATFORM !== 'h5'
- }),
- require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
- ]
- }
- if (webpack.version[0] > 4) {
- delete config.parser
- }
- module.exports = config
|