@@ -5,6 +5,8 @@ import routers from './src/routers/'
55
66const pkg = require ( './package' )
77
8+ const isProduction = process . env . BUILD_ENV === 'production'
9+
810module . exports = {
911 mode : 'universal' ,
1012 srcDir : 'src/' ,
@@ -17,8 +19,42 @@ module.exports = {
1719 externalEndpointUrl : process . env . externalEndpointUrl
1820 } ,
1921
20- // https://qiita.com/toaru/items/0690a9110c94052bb479
21- hardSource : true ,
22+ /*
23+ ** Build configuration
24+ */
25+ build : {
26+ /*
27+ ** You can extend webpack config here
28+ */
29+ extend ( config : Configuration , ctx : Context ) : void {
30+ // Run ESLint on save
31+ if ( ctx . isDev && process . client ) {
32+ if ( config . module ) {
33+ config . module . rules . push ( {
34+ enforce : 'pre' ,
35+ test : / \. ( j s | v u e ) $ / ,
36+ loader : 'eslint-loader' ,
37+ exclude : / ( n o d e _ m o d u l e s ) /
38+ } )
39+ }
40+ }
41+
42+ const vueLoader : any = config . module ! . rules . find (
43+ ( rule ) : boolean => rule . loader === 'vue-loader'
44+ )
45+ vueLoader . options . transformAssetUrls = {
46+ video : [ 'src' , 'poster' ] ,
47+ source : 'src' ,
48+ img : [ 'src' , 'data-src' ] ,
49+ image : 'xlink:href' ,
50+ Test : 'source' ,
51+ 'lazy-image' : 'src'
52+ }
53+ } ,
54+ extractCSS : isProduction ,
55+ // https://qiita.com/toaru/items/0690a9110c94052bb479
56+ hardSource : true
57+ } ,
2258
2359 // https://ja.nuxtjs.org/faq/host-port/
2460 server : {
@@ -89,50 +125,19 @@ module.exports = {
89125 }
90126 ]
91127 ] ,
128+
92129 sentry : {
93130 dsn : 'https://3381f2ffafa94f1cbd9ad904027baaf6@sentry.io/1423878' , // Enter your project's DSN here
94131 config : { } // Additional config
95132 } ,
133+
96134 /*
97135 ** Axios module configuration
98136 */
99137 axios : {
100138 // See https://github.com/nuxt-community/axios-module#options
101139 } ,
102140
103- /*
104- ** Build configuration
105- */
106- build : {
107- /*
108- ** You can extend webpack config here
109- */
110- extend ( config : Configuration , ctx : Context ) : void {
111- // Run ESLint on save
112- if ( ctx . isDev && process . client ) {
113- if ( config . module ) {
114- config . module . rules . push ( {
115- enforce : 'pre' ,
116- test : / \. ( j s | v u e ) $ / ,
117- loader : 'eslint-loader' ,
118- exclude : / ( n o d e _ m o d u l e s ) /
119- } )
120- }
121- }
122-
123- const vueLoader : any = config . module ! . rules . find (
124- ( rule ) : boolean => rule . loader === 'vue-loader'
125- )
126- vueLoader . options . transformAssetUrls = {
127- video : [ 'src' , 'poster' ] ,
128- source : 'src' ,
129- img : [ 'src' , 'data-src' ] ,
130- image : 'xlink:href' ,
131- Test : 'source' ,
132- 'lazy-image' : 'src'
133- }
134- }
135- } ,
136141 router : {
137142 // リロードのタイミングでは SSR 側で実行される
138143 // ルーティングの度に CSR 側で実行される
@@ -150,6 +155,7 @@ module.exports = {
150155 }
151156 }
152157 } ,
158+
153159 styleResources : {
154160 scss : [ '@/assets/styles/components/**/*.scss' ]
155161 }
0 commit comments