Created
March 29, 2017 15:37
-
-
Save jtulk/7cf5ffd95714f7548e4ba7ec10327cb0 to your computer and use it in GitHub Desktop.
Configuration for Babel-Loader Error When Specifying --env
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
{ | |
"scripts": { | |
"build:prod": "webpack --env=prod --colors --profile --json > prod.stats.json", | |
"build:staging": "webpack --env=dev --colors --profile --json > staging.stats.json", | |
"start": "webpack-dev-server --env=dev --open --watch --progress", | |
} | |
} |
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
function buildConfig(env) { | |
return require(`./config/webpack.${env}.config.js`)(env) | |
} | |
module.exports = buildConfig; |
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
const path = require("path"); | |
const webpack = require("webpack"); | |
module.exports = function(env) { | |
return { | |
entry: "./src/app/app.js", | |
output: { | |
path: path.resolve(__dirname, "staging/js"), | |
publicPath: "js/", | |
filename: `app.js`, | |
sourceMapFilename: `app.map.js` | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx?$/, | |
include: [path.resolve(__dirname, "src")], | |
exclude: [ | |
path.resolve(__dirname, "src/js"), | |
path.resolve(__dirname, "node_modules") | |
], | |
loader: "babel-loader", | |
options: { | |
presets: ["es2015", "react", "stage-0"], | |
plugins: [ | |
"transform-async-functions", | |
"transform-object-rest-spread", | |
"transform-regenerator" | |
] | |
} | |
} | |
] | |
}, | |
devtool: "source-map", | |
devServer: { | |
contentBase: "staging", | |
compress: false, | |
port: 9000 | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment