Rift.IO OSM R1 Initial Submission
[osm/UI.git] / skyquake / plugins / composer / 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 /*
19 * Webpack distribution configuration
20 *
21 * This file is set up for serving the distribution version. It will be compiled to dist/ by default
22 */
23
24 'use strict';
25
26 var webpack = require('webpack');
27 var path = require('path');
28 var uiPluginCmakeBuild = process.env.ui_plugin_cmake_build || false;
29 var frameworkPath = uiPluginCmakeBuild?'../../../../skyquake/skyquake-build/framework':'../../framework';
30 var HtmlWebpackPlugin = require('html-webpack-plugin');
31 // Added to overcome node-sass bug https://github.com/iam4x/isomorphic-flux-boilerplate/issues/62
32 process.env.UV_THREADPOOL_SIZE=64;
33 module.exports = {
34 devtool: 'source-map',
35 output: {
36 publicPath: 'assets/',
37 path: 'public/assets/',
38 filename: 'src/main.js'
39 },
40
41 debug: false,
42 entry: [path.resolve(__dirname) + '/src/index.js'],
43
44 stats: {
45 colors: true,
46 reasons: false
47 },
48 resolve: {
49 extensions: ['', '.js', '.jsx', '.css', '.scss'],
50 root: path.resolve(frameworkPath),
51 alias: {
52 'widgets': path.resolve(frameworkPath) + '/widgets',
53 'style': path.resolve(frameworkPath) + '/style',
54 'utils': path.resolve(frameworkPath) + '/utils',
55 'styles': path.join(process.cwd(), './src/styles/'),
56 'libraries': path.join(process.cwd(), './src/libraries/'),
57 'components': path.join(process.cwd(), './src/components/'),
58 //'stores': '../../../src/stores/',
59 //'actions': '../../../src/actions/',
60 'helpers': path.join(process.cwd(), './test/helpers/')
61 }
62 },
63 plugins: [
64 // new webpack.optimize.DedupePlugin(),
65 // new webpack.optimize.UglifyJsPlugin(),
66 // new webpack.optimize.OccurenceOrderPlugin(),
67 // new webpack.optimize.AggressiveMergingPlugin(),
68 // new webpack.NoErrorsPlugin(),
69 new HtmlWebpackPlugin({
70 filename: '../index.html'
71 , templateContent: '<div id="app"></div>'
72 })
73 ],
74
75 module: {
76 noParse: [/autoit.js/],
77 // preLoaders: [
78 // {
79 // test: /\.(js|jsx)$/,
80 // exclude: /node_modules/,
81 // loader: 'eslint-loader'
82 // }
83 // ],
84 loaders: [
85 {
86 test: /\.(js|jsx)$/,
87 exclude: /node_modules/,
88 loader: 'babel-loader',
89 query: {
90 presets: ['es2015', 'stage-0', 'react']
91 }
92 }, {
93 test: /\.css$/,
94 loader: 'style-loader!css-loader'
95 }, {
96 test: /\.scss/,
97 loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded&includePaths[]='+ path.resolve(frameworkPath)
98 },{
99 test: /\.(jpe?g|png|gif|svg|ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/i,
100 loader: "file-loader"
101 },
102 { test: /\.json$/, loader: "json-loader" },
103 ]
104 }
105 };