Skip to content
Snippets Groups Projects
Commit 25a943df authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: override config for dev environment

parent 514d1b76
No related branches found
No related tags found
3 merge requests!103Support,!102Dev,!77Feature/us172 update cozy scripts
'use strict'
const webpack = require('webpack')
const merge = require('webpack-merge')
const { useHotReload, devtool } = require('./webpack.vars')
let plugins = [
new webpack.DefinePlugin({
__DEVELOPMENT__: true,
}),
]
// In development, the bar and cozy-client-js are provided automatically. We use the ProvidePlugin
// since it allows us to use in production the cozy.bar and cozy.client declared by the <script />
// line injected by the stack, while in developement to have it "served" from
// our node_modules
const stackProvidedLibsConfig = {
plugins: [
new webpack.DefinePlugin({
__STACK_ASSETS__: true,
}),
],
module: {
rules: [
{
test: /cozy-bar\/dist\/cozy-bar\.min\.js$/,
// Automatically import the CSS if the JS is imported.
// imports-loader@0.8.0 works but imports-loader@1.0.0 does not
loader: 'imports-loader?css=./cozy-bar.min.css',
},
],
},
}
const output = {}
if (useHotReload) {
plugins = plugins.concat([new webpack.HotModuleReplacementPlugin()])
output.globalObject = 'this'
}
module.exports = merge(
{
devtool: devtool || 'cheap-module-eval-source-map',
mode: 'development',
externals: ['cozy'],
plugins,
output,
optimization: {
removeAvailableModules: false,
removeEmptyChunks: false,
},
},
stackProvidedLibsConfig
)
......@@ -33,9 +33,9 @@ const configs = [
]
if (environment === 'production') {
configs.push(require('cozy-scripts/config/webpack.environment.prod'))
configs.push(require('./app.config.environment.dev'))
} else {
configs.push(require('cozy-scripts/config/webpack.environment.dev'))
configs.push(require('cozy-scripts/config/webpack.environment.prod'))
}
//module.exports = merge.apply(null, configs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment