-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmpx.config.js
More file actions
45 lines (44 loc) · 1.3 KB
/
mpx.config.js
File metadata and controls
45 lines (44 loc) · 1.3 KB
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
const { defineConfig } = require('@vue/cli-service')
const { UnifiedWebpackPluginV5 } = require('weapp-tailwindcss/webpack')
const path = require('path')
const tailwindPostcss = require('@tailwindcss/postcss')
module.exports = defineConfig({
outputDir: `dist/${process.env.MPX_CURRENT_TARGET_MODE}`,
pluginOptions: {
mpx: {
plugin: {
postcssInlineConfig: {
ignoreConfigFile: true,
plugins: [
tailwindPostcss()
]
},
srcMode: 'wx',
hackResolveBuildDependencies: ({ files, resolveDependencies }) => {
const path = require('path')
const packageJSONPath = path.resolve('package.json')
if (files.has(packageJSONPath)) files.delete(packageJSONPath)
if (resolveDependencies.files.has(packageJSONPath)) {
resolveDependencies.files.delete(packageJSONPath)
}
}
},
loader: {},
}
},
/**
* 如果希望node_modules下的文件时对应的缓存可以失效,
* 可以将configureWebpack.snap.managedPaths修改为 []
*/
configureWebpack(config) {
config.plugins.push(
new UnifiedWebpackPluginV5({
rem2rpx: true,
appType: 'mpx',
cssEntries: [
path.resolve(__dirname, 'src/app.css')
]
})
)
}
})