Rift.IO OSM R1 Initial Submission
[osm/UI.git] / skyquake / plugins / goodbyeworld / webpack.production.config.js
1 /*
2 *
3 * Copyright 2016 RIFT.IO Inc
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18 var Webpack = require('webpack');
19 var path = require('path');
20 var nodeModulesPath = path.resolve(__dirname, 'node_modules');
21 var buildPath = path.resolve(__dirname, 'public', 'build');
22 var mainPath = path.resolve(__dirname, 'src', 'main.js');
23 var uiPluginCmakeBuild = process.env.ui_plugin_cmake_build || false;
24 var frameworkPath = uiPluginCmakeBuild?'../../../../skyquake/skyquake-build/framework':'../../framework';
25 var HtmlWebpackPlugin = require('html-webpack-plugin');
26 // Added to overcome node-sass bug https://github.com/iam4x/isomorphic-flux-boilerplate/issues/62
27 process.env.UV_THREADPOOL_SIZE=64;
28 var config = {
29 devtool: 'source-map',
30 entry: mainPath,
31 output: {
32 path: buildPath,
33 filename: 'bundle.js',
34 publicPath: "build/"
35 },
36 resolve: {
37 extensions: ['', '.js', '.jsx', '.css', '.scss'],
38 root: path.resolve(frameworkPath),
39 alias: {
40 'widgets': path.resolve(frameworkPath) + '/widgets',
41 'style': path.resolve(frameworkPath) + '/style'
42 }
43 },
44 module: {
45 loaders: [{
46 test: /\.(jpe?g|png|gif|svg|ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/i,
47 loader: "file-loader"
48 },
49 {
50 test: /\.(js|jsx)$/,
51 exclude: /node_modules/,
52 loader: 'babel-loader',
53 query: {
54 presets: ["es2015", "stage-0", "react"]
55 }
56 }, {
57 test: /\.css$/,
58 loader: 'style!css'
59 }, {
60 test: /\.scss/,
61 loader: 'style!css!sass'
62 }
63 ]
64 },
65 plugins: [
66 new HtmlWebpackPlugin({
67 filename: '../index.html',
68 templateContent: '<div id="content"></div>'
69 }),
70 new Webpack.optimize.CommonsChunkPlugin("vendor", "vendor.js", Infinity)
71 ]
72 };
73 module.exports = config;