Files
react-jsonschema-form/webpack.config.prod.js
Ethan Glasser-Camp b6ae4f44b7 Bump webpack (#1040)
* An empty string is no longer required with webpack v3

See https://webpack.js.org/migrate/3/#resolve-extensions.

* Update loaders

module.loaders is now module.rules.

https://webpack.js.org/migrate/3/#module-loaders-is-now-module-rules

Chaining loaders is no longer done using !. We only do this in one
place (style!css).

https://webpack.js.org/migrate/3/#chaining-loaders

It's no longer allowed to omit -loader.

https://webpack.js.org/migrate/3/#automatic-loader-module-name-extension-removed

We no longer need json-loader.

https://webpack.js.org/migrate/3/#json-loader-is-not-required-anymore

* ExtractTextPlugin needs a version bump

https://webpack.js.org/migrate/3/#new-extracttextplugin-options-

* Output path needs to be absolute

* NoErrorsPlugin is deprecated

* Actually upgrade webpack version

* Bump versions to webpack v4

* Move ExtractTextWebpackPlugin to MiniCssExtractPlugin for webpack v4

* Add a "mode" to each config

https://webpack.js.org/migrate/4/#mode

* This doesn't seem to be necessary any more

The documentation seems to say this is the default during prod, but I
haven't been able to make it emit any bad assets in dev either.

* This is the default in "production" mode
2018-10-26 15:27:09 -04:00

54 lines
1.2 KiB
JavaScript

var path = require("path");
var webpack = require("webpack");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
mode: "production",
entry: "./playground/app",
output: {
path: path.join(__dirname, "build"),
filename: "bundle.js",
publicPath: "/static/"
},
plugins: [
new MiniCssExtractPlugin({filename: "styles.css", allChunks: true}),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
})
],
resolve: {
extensions: [".js", ".jsx", ".css"]
},
module: {
rules: [
{
test: /\.jsx?$/,
use: [
"babel-loader",
],
include: [
path.join(__dirname, "src"),
path.join(__dirname, "playground"),
path.join(__dirname, "node_modules", "codemirror", "mode", "javascript"),
],
},
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
"css-loader",
],
include: [
path.join(__dirname, "css"),
path.join(__dirname, "playground"),
path.join(__dirname, "node_modules"),
],
}
]
}
};