Optimize build process
This commit is contained in:
parent
735737f4a2
commit
c99cc70bcf
5 changed files with 958 additions and 37 deletions
37
webpack.common.js
Normal file
37
webpack.common.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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 CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
|
||||
const preBuildScripts = process.env.NO_FLOW == undefined ?
|
||||
process.env.FLOW_PATH != undefined ? [process.env.FLOW_PATH] : ['flow']
|
||||
: [];
|
||||
|
||||
module.exports = {
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx']
|
||||
},
|
||||
entry: [
|
||||
path.resolve(__dirname, 'src/index.jsx')
|
||||
],
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'main.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.(woff2?|eot|ttf|svg)$/, loader: "file-loader" }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(["dist"]),
|
||||
// new WebpackShellPlugin({onBuildStart:preBuildScripts}),
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'Space Map',
|
||||
template: 'index.ejs'
|
||||
}),
|
||||
new ExtractTextPlugin("styles.css")
|
||||
]
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue