11// see http://vuejs-templates.github.io/webpack for documentation.
22var path = require ( 'path' )
3+ var fileExtConfig = {
4+ swan : {
5+ template : 'swan' ,
6+ script : 'js' ,
7+ style : 'css' ,
8+ platform : 'swan'
9+ } ,
10+ wx : {
11+ template : 'wxmp' ,
12+ script : 'js' ,
13+ style : 'wxss' ,
14+ platform : 'wx'
15+ }
16+ }
17+ var fileExt = fileExtConfig [ process . env . PLATFORM ]
318
419module . exports = {
520 build : {
621 env : require ( './prod.env' ) ,
7- index : path . resolve ( __dirname , ' ../dist/index.html' ) ,
8- assetsRoot : path . resolve ( __dirname , ' ../dist' ) ,
22+ index : path . resolve ( __dirname , ` ../dist/${ fileExt . platform } / index.html` ) ,
23+ assetsRoot : path . resolve ( __dirname , ` ../dist/ ${ fileExt . platform } ` ) ,
924 assetsSubDirectory : '' ,
1025 assetsPublicPath : '/' ,
1126 productionSourceMap : false ,
@@ -19,7 +34,8 @@ module.exports = {
1934 // View the bundle analyzer report after build finishes:
2035 // `npm run build --report`
2136 // Set to `true` or `false` to always turn it on or off
22- bundleAnalyzerReport : process . env . npm_config_report
37+ bundleAnalyzerReport : process . env . npm_config_report ,
38+ fileExt : fileExt
2339 } ,
2440 dev : {
2541 env : require ( './dev.env' ) ,
@@ -34,6 +50,7 @@ module.exports = {
3450 // (https://github.com/webpack/css-loader#sourcemaps)
3551 // In our experience, they generally work as expected,
3652 // just be aware of this issue when enabling this option.
37- cssSourceMap : false
53+ cssSourceMap : false ,
54+ fileExt : fileExt
3855 }
3956}
0 commit comments