Optimize build process

This commit is contained in:
uwap 2017-11-06 09:39:55 +01:00
parent 735737f4a2
commit c99cc70bcf
5 changed files with 958 additions and 37 deletions

View file

@ -1,46 +0,0 @@
// webpack.config.js:
const path = require('path');
const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const preBuildScripts = process.env.NO_FLOW == undefined ?
process.env.FLOW_PATH != undefined ? [process.env.FLOW_PATH] : ['flow']
: [];
const extractTextCSSLoader = ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
});
module.exports = {
resolve: {
extensions: ['.js', '.jsx']
},
entry: [
path.resolve(__dirname, 'src/index.jsx')
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
publicPath: './'
},
module: {
loaders: [
{ test: /\.(woff2?|eot|ttf|svg)$/, loader: "file-loader" },
{ test: /\.css$/, use: extractTextCSSLoader },
{ test: /\.js(x)?$/, exclude: /node_modules/, loader: "babel-loader" }
]
},
plugins: [
new WebpackShellPlugin({onBuildStart:preBuildScripts}),
new HtmlWebpackPlugin({
title: 'Space Map',
template: 'index.ejs'
}),
new ExtractTextPlugin("styles.css")
],
devtool: 'source-map'
};