-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.client.js
82 lines (72 loc) · 2.58 KB
/
webpack.config.client.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const path = require( 'path' );
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' );
const webpack = require( 'webpack' );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getConfig() {
const outputPath = 'build/';
return {
devtool: '#source-map',
entry: {
'init-client': './init-client.js'
},
output: {
path: path.resolve( __dirname, outputPath ),
publicPath: outputPath,
filename: '[name].bundle.js'
},
plugins: [
...[ new ExtractTextPlugin( { filename: '[name].bundle.css' } ) ],
new webpack.optimize.ModuleConcatenationPlugin()
],
resolve: {
modules: [ path.resolve( __dirname, 'node_modules' ) ],
extensions: [ '.js' ],
alias: {
'laxar': path.resolve(__dirname, 'application/lib/laxar-client' ),
'default.theme': path.resolve(__dirname, '../application/lib/laxar-uikit/theme/default.theme' )
}
},
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /.spec.js$/,
exclude: /node_modules/,
loader: 'laxar-mocks/spec-loader'
},
{ // load styles, images and fonts with the file-loader
// (out-of-bundle in build/assets/)
test: /\.(gif|jpe?g|png|ttf|woff2?|svg|eot|otf)(\?.*)?$/,
loader: 'file-loader',
options: {
name: 'assets/[path]-[name].[ext]'
}
},
{ // ... after optimizing graphics with the image-loader ...
test: /\.(gif|jpe?g|png|svg)$/,
loader: 'img-loader?progressive=true'
},
{ // ... and resolving CSS url()s with the css loader
// (extract-loader extracts the CSS string from the JS module returned by the css-loader)
test: /\.(css|s[ac]ss)$/,
loader: ExtractTextPlugin.extract( {
fallback: 'style-loader',
use: 'css-loader',
publicPath: ''
} )
},
{
test: /[/]default[.]theme[/].*[.]s[ac]ss$/,
loader: 'sass-loader',
options: require( 'laxar-uikit/themes/default.theme/sass-options' )
}
]
}
};
}
const configuration = getConfig();
module.exports = configuration;