improvement: detect dev mode for Svelte compilation
This commit is contained in:
parent
e71f8476bb
commit
06c8a217e0
|
@ -8,8 +8,8 @@
|
||||||
"node": "10.15.0"
|
"node": "10.15.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run clean:build && webpack --config=./webpack.prod.js",
|
"build": "npm run clean:build && NODE_ENV=production webpack --config=./webpack.prod.js",
|
||||||
"build:dev": "npm run clean:build && webpack --config=./webpack.dev.js",
|
"build:dev": "npm run clean:build && NODE_ENV=development webpack --config=./webpack.dev.js",
|
||||||
"build:firebase:hosting": "npm run clean:build && NODE_ENV=production NODE_APP=firebase webpack --config=./webpack.prod.js",
|
"build:firebase:hosting": "npm run clean:build && NODE_ENV=production NODE_APP=firebase webpack --config=./webpack.prod.js",
|
||||||
"build:firebase:hosting:dev": "npm run clean:build && NODE_ENV=development NODE_APP=firebase webpack --config=./webpack.dev.js",
|
"build:firebase:hosting:dev": "npm run clean:build && NODE_ENV=development NODE_APP=firebase webpack --config=./webpack.dev.js",
|
||||||
"clean:build": "rm dist/** || true",
|
"clean:build": "rm dist/** || true",
|
||||||
|
|
|
@ -12,6 +12,9 @@ const isFirebaseEnv = process.env.NODE_APP === 'firebase'
|
||||||
const firebaseConfigFilePath = path.join(__dirname, '.firebaserc')
|
const firebaseConfigFilePath = path.join(__dirname, '.firebaserc')
|
||||||
const hasFirebaseConfig = fs.existsSync(firebaseConfigFilePath)
|
const hasFirebaseConfig = fs.existsSync(firebaseConfigFilePath)
|
||||||
|
|
||||||
|
const isDev = process.env.NODE_ENV === 'development'
|
||||||
|
console.log(`Detected dev mode? ${isDev}`)
|
||||||
|
|
||||||
if (isFirebaseEnv && hasFirebaseConfig) {
|
if (isFirebaseEnv && hasFirebaseConfig) {
|
||||||
console.info('Prepare build for Firebase hosting')
|
console.info('Prepare build for Firebase hosting')
|
||||||
}
|
}
|
||||||
|
@ -43,6 +46,8 @@ module.exports = {
|
||||||
loader: 'svelte-loader',
|
loader: 'svelte-loader',
|
||||||
options: {
|
options: {
|
||||||
emitCss: false,
|
emitCss: false,
|
||||||
|
hotReload: isDev,
|
||||||
|
dev: isDev,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue