forked from cozy/create-cozy-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.environment.dev.js
48 lines (43 loc) · 1.14 KB
/
webpack.environment.dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict'
const webpack = require('webpack')
const paths = require('../utils/paths')
const HtmlWebpackIncludeAssetsPlugin = require('html-webpack-include-assets-plugin')
const CopyPlugin = require('copy-webpack-plugin')
const { useHotReload } = require('./webpack.vars')
const buildCozyBarCss = `${paths.appBuild()}/cozy-bar.css`
const buildCozyBarJs = `${paths.appBuild()}/cozy-bar.js`
const buildCozyClientJs = `${paths.appBuild()}/cozy-client-js.js`
let plugins = [
new webpack.DefinePlugin({
__DEVELOPMENT__: true,
__STACK_ASSETS__: false
}),
new CopyPlugin([
{
from: paths.appCozyBarJs(),
to: buildCozyBarJs
},
{
from: paths.appCozyBarCss(),
to: buildCozyBarCss
},
{
from: paths.appCozyClientJs(),
to: buildCozyClientJs
}
]),
new HtmlWebpackIncludeAssetsPlugin({
assets: ['cozy-bar.js', 'cozy-bar.css', 'cozy-client-js.js'],
append: false,
publicPath: true
})
]
if (useHotReload) {
plugins = plugins.concat([new webpack.HotModuleReplacementPlugin()])
}
module.exports = {
devtool: '#source-map',
mode: 'development',
externals: ['cozy'],
plugins
}