Last active
February 28, 2016 10:28
-
-
Save jakubkulhan/4b9388cb0bd000a711b9 to your computer and use it in GitHub Desktop.
Base package.json + webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"devDependencies": { | |
"webpack-dev-server": "^1.14.1" | |
}, | |
"dependencies": { | |
"assets-webpack-plugin": "^3.3.0", | |
"babel-loader": "^6.2.2", | |
"babel-plugin-syntax-object-rest-spread": "^6.5.0", | |
"babel-plugin-transform-object-rest-spread": "^6.5.0", | |
"babel-polyfill": "^6.5.0", | |
"babel-preset-es2015": "^6.5.0", | |
"babel-preset-react": "^6.5.0", | |
"css-loader": "^0.23.1", | |
"exports-loader": "^0.6.3", | |
"extract-text-webpack-plugin": "^1.0.1", | |
"file-loader": "^0.8.4", | |
"imports-loader": "^0.6.5", | |
"less": "^2.6.0", | |
"less-loader": "^2.2.0", | |
"node-libs-browser": "^1.0.0", | |
"style-loader": "^0.13.0", | |
"url-loader": "^0.5.7", | |
"webpack": "^1.12.13" | |
}, | |
"scripts": { | |
"build": "webpack -p --progress --profile", | |
"dev": "BUILD_DEV=true webpack-dev-server -d --hot --inline --progress --colors --inline --content-base ./src/main/resources --port 8081 --output-public-path http://localhost:8081/assets/" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require("webpack"); | |
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
var AssetsPlugin = require("assets-webpack-plugin"); | |
var __DEV__ = JSON.parse(process.env.BUILD_DEV || "false"); | |
module.exports = { | |
entry: { | |
all: ["./client-src/main"] | |
}, | |
output: { | |
path: "./www/assets", | |
publicPath: "/assets/", | |
filename: __DEV__ ? "[name].js" : "[name]-[hash].js" | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.css$/, | |
loader: ExtractTextPlugin.extract("style-loader", "css-loader") | |
}, | |
{ | |
test: /\.less$/, | |
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader") | |
}, | |
{ | |
test: /\.(woff2?|ttf|eot|svg|jpg|png|gif|swf)(\?.*)?$/, | |
loader: "file-loader" | |
}, | |
{ | |
test: /\.jsx$/, | |
exclude: /node_modules/, | |
loader: "babel-loader", | |
query: { | |
cacheDirectory: true, | |
presets: ["es2015", "react"], | |
plugins: [ | |
"syntax-object-rest-spread", | |
"transform-object-rest-spread" | |
] | |
} | |
} | |
] | |
}, | |
resolve: { | |
extensions: ["", ".js", ".jsx", ".json"] | |
}, | |
plugins: [ | |
new webpack.DefinePlugin({ | |
__DEV__: JSON.stringify(__DEV__), | |
'process.env.NODE_ENV': __DEV__ ? '"development"' : '"production"' | |
}), | |
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /cs/), | |
new ExtractTextPlugin(__DEV__ ? "[name].css" : "[name]-[hash].css"), | |
new AssetsPlugin({path: __dirname + "/www/assets"}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment