Merge branch 'master' of https://osm.etsi.org/gerrit/osm/UI
[osm/UI.git] / skyquake / plugins / config / webpack.production.config.js
1 /*
2 * STANDARD_RIFT_IO_COPYRIGHT
3 */
4 var Webpack = require('webpack');
5 var path = require('path');
6 var nodeModulesPath = path.resolve(__dirname, 'node_modules');
7 var buildPath = path.resolve(__dirname, 'public', 'build');
8 var mainPath = path.resolve(__dirname, 'src', 'main.js');
9 var uiPluginCmakeBuild = process.env.ui_plugin_cmake_build || false;
10 var frameworkPath = uiPluginCmakeBuild?'../../../../skyquake/skyquake-build/framework':'../../framework';
11 var HtmlWebpackPlugin = require('html-webpack-plugin');
12 var CommonsPlugin = new require("webpack/lib/optimize/CommonsChunkPlugin")
13 // Added to overcome node-sass bug https://github.com/iam4x/isomorphic-flux-boilerplate/issues/62
14 process.env.UV_THREADPOOL_SIZE=64;
15 var config = {
16 devtool: 'source-map',
17 entry: mainPath,
18 output: {
19 path: buildPath,
20 filename: 'bundle.js',
21 publicPath: "build/"
22 },
23 resolve: {
24 extensions: ['', '.js', '.jsx', '.css', '.scss'],
25 root: path.resolve(frameworkPath),
26 alias: {
27 'widgets': path.resolve(frameworkPath) + '/widgets',
28 'style': path.resolve(frameworkPath) + '/style',
29 'utils': path.resolve(frameworkPath) + '/utils'
30 }
31 },
32 module: {
33 loaders: [{
34 test: /\.(jpe?g|png|gif|svg|ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/i,
35 loader: "file-loader"
36 },
37 {
38 test: /\.(js|jsx)$/,
39 exclude: /react-treeview/,
40 loader: 'babel-loader',
41 query: {
42 presets: ["es2015", "stage-0", "react"]
43 }
44 }, {
45 test: /\.css$/,
46 loader: 'style!css'
47 }, {
48 test: /\.scss/,
49 loader: 'style!css!sass?includePaths[]='+ path.resolve(frameworkPath)
50 }
51 ]
52 },
53 plugins: [
54 new HtmlWebpackPlugin({
55 filename: '../index.html'
56 , templateContent: '<div id="app"></div>'
57 }),
58 new Webpack.optimize.CommonsChunkPlugin("vendor", "vendor.js", Infinity)
59 ]
60 };
61 module.exports = config;