This repository was archived by the owner on Jul 10, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ module.exports = {
1111 mode : 'universal' ,
1212 srcDir : 'src/' ,
1313
14+ // ビルド時に渡される env の値は、ここに記載することで文字列に置換される
1415 env : {
1516 NODE_ENV : process . env . NODE_ENV ,
1617 BUILD_ENV : process . env . BUILD_ENV ,
@@ -42,6 +43,7 @@ module.exports = {
4243 const vueLoader : any = config . module ! . rules . find (
4344 ( rule ) : boolean => rule . loader === 'vue-loader'
4445 )
46+ // 特殊なアトリビュートでも webpack の require がかまされるようにする
4547 vueLoader . options . transformAssetUrls = {
4648 video : [ 'src' , 'poster' ] ,
4749 source : 'src' ,
@@ -53,7 +55,16 @@ module.exports = {
5355 } ,
5456 extractCSS : isProduction ,
5557 // https://qiita.com/toaru/items/0690a9110c94052bb479
56- hardSource : true
58+ hardSource : true ,
59+ terser : {
60+ terserOptions : {
61+ compress : {
62+ // console 系を削除する
63+ // https://www.lancard.com/blog/2019/04/05/delete_console-log_at_nuxt_build/
64+ drop_console : process . env . envName === 'production' // eslint-disable-line @typescript-eslint/camelcase
65+ }
66+ }
67+ }
5768 } ,
5869
5970 // https://ja.nuxtjs.org/faq/host-port/
Original file line number Diff line number Diff line change 88 "dev" : " cross-env NODE_ENV=development BUILD_ENV=local nuxt" ,
99 "build" : " nuxt build --no-lock" ,
1010 "build:static" : " nuxt build --spa --no-lock" ,
11- "build:local" : " cross-env NODE_ENV=production BUILD_ENV=local nuxt build --no-lock" ,
11+ "build:local" : " cross-env NODE_ENV=production BUILD_ENV=local envName=local nuxt build --no-lock" ,
1212 "build:docker" : " cross-env NODE_ENV=production nuxt build --no-lock" ,
1313 "start" : " nuxt start" ,
1414 "lint" : " eslint --ext .js,.ts,.vue --ignore-path .gitignore ." ,
You can’t perform that action at this time.
0 commit comments