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