Add more comments in webpack.js#186
Conversation
|
/cc @MangelMaxime I grabbed the |
theimowski
left a comment
There was a problem hiding this comment.
I'm ok with added comments and renaming the environment variable name - should make things clearer.
Curious what @MangelMaxime says about the CONFIG object
|
The But I think, if you are using a template you should not need to modify the So it's up to you depending on what you prefer. Personnaly, at work I don't have the // Common/shared variables
var babelOptions = {
presets: [
["@babel/preset-env", {
"targets": {
"browsers": ["last 2 versions"]
},
"modules": false,
"useBuiltIns": "usage"
}],
"@babel/react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
]
};
var commonPlugins = [
new HtmlWebpackPlugin({
filename: './index.html',
template: './Sources/index.html'
}),
];
// Usage
module.exports = {
// ...
plugins: isProduction ?
commonPlugins.concat([
new MiniCssExtractPlugin({
filename: 'style.[hash].css'
})
])
: commonPlugins.concat([
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin()
]),
// ...
module: {
rules: [
{
test: /\.fs(x|proj)?$/,
use: {
loader: "fable-loader",
options: {
babel: babelOptions
}
}
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: babelOptions
},
},
]
}
// ...
}; |
|
Fair enough, let's inline that |
Added more comments to the
webpack.config.jsfile. I also removed the CONFIG object and embedded it directly into the configuration - I'm not sure if this is better or worse, happy to revert that, but for me as a non-webpack person it means one less object to reason about in the file.Also renamed the server proxy port to
SERVER_PROXY_PORT- otherwise it could be confusing for people using different web servers. Theoretically this is a breaking change so I would like to get this in before v1.