Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import webpack from "webpack";
- import HtmlPlugin from "html-webpack-plugin";
- import ExtractTextPlugin from "extract-text-webpack-plugin";
- import NpmInstallPlugin from "npm-install-webpack-plugin";
- import path from "path";
- function dist(...args) {
- return path.resolve(__dirname, "dist", ...args);
- }
- function src(...args) {
- return path.resolve(__dirname, "src", ...args);
- }
- const config = {
- entry: [
- src("index.js"),
- src("index.styl")
- ],
- output: {
- path: dist(),
- filename: "index.js"
- },
- resolve: {
- extensions: [".js",".jsx"]
- },
- externals: ["shaka"],
- module: {
- rules: [
- {
- test: /\.jsx?$/,
- use: "babel-loader"
- },
- {
- test: /\.styl$/,
- use: ExtractTextPlugin.extract({
- use: [{
- loader: "css-loader",
- options: {
- module: true
- }
- },"stylus-loader"]
- })
- }
- ]
- },
- plugins: [
- new NpmInstallPlugin(),
- new HtmlPlugin({
- title: "Sync PoC",
- template: src("index.html")
- }),
- new ExtractTextPlugin("index.css"),
- new webpack.DefinePlugin({
- "process.env": {
- "NODE_ENV": JSON.stringify(process.env.NODE_ENV || "development")
- }
- }),
- new webpack.HotModuleReplacementPlugin(),
- new webpack.optimize.UglifyJsPlugin()
- ],
- devtool: "source-map",
- devServer: {
- historyApiFallback: true,
- contentBase: dist(),
- port: process.env.PORT || 4000,
- hot: true
- }
- };
- export default config;
Add Comment
Please, Sign In to add comment