40 lines
1020 B
JavaScript
40 lines
1020 B
JavaScript
|
const TransformPages = require('uni-read-pages')
|
||
|
const ESLintPlugin = require('eslint-webpack-plugin')
|
||
|
const { webpack } = new TransformPages()
|
||
|
const path = require('path')
|
||
|
|
||
|
const resolve = (dir) => {
|
||
|
return path.join(__dirname, dir)
|
||
|
}
|
||
|
module.exports = {
|
||
|
publicPath: process.env.VUE_APP_PUBLIC_PATH || '/',
|
||
|
devServer: {
|
||
|
hot: true,
|
||
|
port: 8088
|
||
|
},
|
||
|
transpileDependencies: ['@dcloudio/uni-ui', 'uni-simple-router', '/node_modules/uni-simple-router'],
|
||
|
configureWebpack: {
|
||
|
plugins: [
|
||
|
new webpack.DefinePlugin({
|
||
|
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
|
||
|
const tfPages = new TransformPages({
|
||
|
includes: ['path', 'name', 'aliasPath', 'needLogin']
|
||
|
})
|
||
|
return JSON.stringify(tfPages.routes)
|
||
|
}, true)
|
||
|
}),
|
||
|
new ESLintPlugin({
|
||
|
fix: true,
|
||
|
emitError: true,
|
||
|
emitWarning: true
|
||
|
})
|
||
|
],
|
||
|
resolve: {
|
||
|
alias: {
|
||
|
'@': resolve('src'),
|
||
|
'@/static': resolve('static')
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|