create-application-template 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ const { merge } = require('webpack-merge')
2
+ const commonConfig = require('./webpack.common.js')
3
+
4
+ require('dotenv-flow').config()
5
+
6
+ module.exports = (webpackEnv) => {
7
+ const { BUNDLER_ENV } = webpackEnv
8
+
9
+ const envConfig = require(`./webpack.${BUNDLER_ENV}.js`)
10
+
11
+ const config = merge(commonConfig(webpackEnv), envConfig(webpackEnv))
12
+
13
+ return config
14
+ }
@@ -0,0 +1,40 @@
1
+ const webpack = require('webpack')
2
+ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin')
3
+ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin')
4
+ const packageJson = require('../package.json')
5
+
6
+ module.exports = () => {
7
+ const { PORT } = process.env
8
+
9
+ return {
10
+ mode: 'development', // NODE_ENV
11
+ devtool: 'cheap-module-source-map',
12
+ devServer: {
13
+ // static: {
14
+ // directory: paths.build,
15
+ // },
16
+ hot: true,
17
+ open: true,
18
+ port: PORT || 3333,
19
+ proxy: [
20
+ {
21
+ context: ['/'],
22
+ target: packageJson.proxy,
23
+ },
24
+ ],
25
+ historyApiFallback: true,
26
+ },
27
+ plugins: [
28
+ new webpack.DefinePlugin({
29
+ 'process.env.EXAMPLE': JSON.stringify('devconfig'),
30
+ }),
31
+ // NOTE per the docs added "react-refresh/babel" (r-r/b) to
32
+ // .babelrc and babel-loader, but seems to work without r-r/b...
33
+ // docs also used to say use webpack.HotModuleRepalcementPlugin,
34
+ // which also seemed to be unneeded, and now they don't...
35
+ // so be on the lookout for doc changes related to r-r/b too
36
+ new ReactRefreshWebpackPlugin(),
37
+ new CaseSensitivePathsPlugin(),
38
+ ],
39
+ }
40
+ }
@@ -0,0 +1,34 @@
1
+ const webpack = require('webpack')
2
+ const TerserPlugin = require('terser-webpack-plugin')
3
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
4
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
5
+ const getPaths = require('./utilities/getPaths')
6
+ const getTerserOptions = require('./utilities/getTerserOptions')
7
+
8
+ module.exports = (webpackEnv) => {
9
+ const { BUNDLER_ENV, BUNDLER_WITH_PROFILING } = webpackEnv
10
+
11
+ const paths = getPaths({ BUNDLER_ENV })
12
+ const terserOptions = getTerserOptions({ BUNDLER_WITH_PROFILING })
13
+
14
+ return {
15
+ mode: 'production', // NODE_ENV
16
+ devtool: 'source-map',
17
+ optimization: {
18
+ minimize: true,
19
+ minimizer: [
20
+ new TerserPlugin({ terserOptions }),
21
+ new CssMinimizerPlugin(),
22
+ ],
23
+ },
24
+ plugins: [
25
+ new webpack.DefinePlugin({
26
+ 'process.env.EXAMPLE': JSON.stringify('prodconfig'),
27
+ }),
28
+ new MiniCssExtractPlugin({
29
+ filename: paths.static.css.filenameCss,
30
+ chunkFilename: paths.static.css.chunkFilenameCss,
31
+ }),
32
+ ],
33
+ }
34
+ }