Skip to content

Commit ed42545

Browse files
committed
Fix build script
1 parent a0b5900 commit ed42545

File tree

2 files changed

+3
-161
lines changed

2 files changed

+3
-161
lines changed

config/webpack.build.js

+2-160
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
const paths = require('./paths')
22
const packageJson = require('../package')
33

4-
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
5-
6-
const postcssNormalize = require('postcss-normalize')
7-
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent')
8-
94
const dependencies = Object.keys(packageJson.dependencies)
105
const devDependencies = Object.keys(packageJson.devDependencies)
116
const externals = [
@@ -14,72 +9,6 @@ const externals = [
149
/.*material-ui.*/,
1510
]
1611

17-
// style files regexes
18-
const cssRegex = /\.css$/
19-
const cssModuleRegex = /\.module\.css$/
20-
const sassRegex = /\.(scss|sass)$/
21-
const sassModuleRegex = /\.module\.(scss|sass)$/
22-
23-
const isEnvProduction = true
24-
const isEnvDevelopment = false
25-
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'
26-
27-
const getStyleLoaders = (cssOptions, preProcessor) => {
28-
const loaders = [
29-
isEnvDevelopment && require.resolve('style-loader'),
30-
isEnvProduction && {
31-
loader: MiniCssExtractPlugin.loader,
32-
options: {},
33-
},
34-
{
35-
loader: require.resolve('css-loader'),
36-
options: cssOptions,
37-
},
38-
{
39-
// Options for PostCSS as we reference these options twice
40-
// Adds vendor prefixing based on your specified browser support in
41-
// package.json
42-
loader: require.resolve('postcss-loader'),
43-
options: {
44-
// Necessary for external CSS imports to work
45-
// https://github.com/facebook/create-react-app/issues/2677
46-
ident: 'postcss',
47-
plugins: () => [
48-
require('postcss-flexbugs-fixes'),
49-
require('postcss-preset-env')({
50-
autoprefixer: {
51-
flexbox: 'no-2009',
52-
},
53-
stage: 3,
54-
}),
55-
// Adds PostCSS Normalize as the reset css with default options,
56-
// so that it honors browserslist config in package.json
57-
// which in turn let's users customize the target behavior as per their needs.
58-
postcssNormalize(),
59-
],
60-
sourceMap: isEnvProduction && shouldUseSourceMap,
61-
},
62-
},
63-
].filter(Boolean)
64-
if (preProcessor) {
65-
loaders.push(
66-
{
67-
loader: require.resolve('resolve-url-loader'),
68-
options: {
69-
sourceMap: isEnvProduction && shouldUseSourceMap,
70-
},
71-
},
72-
{
73-
loader: require.resolve(preProcessor),
74-
options: {
75-
sourceMap: true,
76-
},
77-
}
78-
)
79-
}
80-
return loaders
81-
}
82-
8312
module.exports = {
8413
mode: 'production',
8514
entry: paths.appIndexJs,
@@ -90,7 +19,7 @@ module.exports = {
9019
},
9120
externals: externals,
9221
optimization: {
93-
minimize: false
22+
minimize: true,
9423
},
9524
module: {
9625
strictExportPresence: true,
@@ -150,96 +79,9 @@ module.exports = {
15079
// See #6846 for context on why cacheCompression is disabled
15180
cacheCompression: false,
15281

153-
// TODO
154-
// compact: true,
82+
compact: true,
15583
},
15684
},
157-
158-
// {
159-
// test: cssRegex,
160-
// exclude: cssModuleRegex,
161-
// use: getStyleLoaders({
162-
// importLoaders: 1,
163-
// sourceMap: isEnvProduction && shouldUseSourceMap,
164-
// }),
165-
// // Don't consider CSS imports dead code even if the
166-
// // containing package claims to have no side effects.
167-
// // Remove this when webpack adds a warning or an error for this.
168-
// // See https://github.com/webpack/webpack/issues/6571
169-
// sideEffects: true,
170-
// },
171-
// // Adds support for CSS Modules (https://github.com/css-modules/css-modules)
172-
// // using the extension .module.css
173-
// {
174-
// test: cssModuleRegex,
175-
// use: getStyleLoaders({
176-
// importLoaders: 1,
177-
// sourceMap: isEnvProduction && shouldUseSourceMap,
178-
// modules: true,
179-
// getLocalIdent: getCSSModuleLocalIdent,
180-
// }),
181-
// },
182-
// // Opt-in support for SASS (using .scss or .sass extensions).
183-
// // By default we support SASS Modules with the
184-
// // extensions .module.scss or .module.sass
185-
// {
186-
// test: sassRegex,
187-
// exclude: sassModuleRegex,
188-
// use: getStyleLoaders(
189-
// {
190-
// importLoaders: 2,
191-
// sourceMap: isEnvProduction && shouldUseSourceMap,
192-
// },
193-
// 'sass-loader'
194-
// ),
195-
// // Don't consider CSS imports dead code even if the
196-
// // containing package claims to have no side effects.
197-
// // Remove this when webpack adds a warning or an error for this.
198-
// // See https://github.com/webpack/webpack/issues/6571
199-
// sideEffects: true,
200-
// },
201-
// // Adds support for CSS Modules, but using SASS
202-
// // using the extension .module.scss or .module.sass
203-
// {
204-
// test: sassModuleRegex,
205-
// use: getStyleLoaders(
206-
// {
207-
// importLoaders: 2,
208-
// sourceMap: isEnvProduction && shouldUseSourceMap,
209-
// modules: true,
210-
// getLocalIdent: getCSSModuleLocalIdent,
211-
// },
212-
// 'sass-loader'
213-
// ),
214-
// },
215-
216-
// Process any JS outside of the app with Babel.
217-
// Unlike the application JS, we only compile the standard ES features.
218-
// {
219-
// test: /\.(js|mjs)$/,
220-
// exclude: /@babel(?:\/|\\{1,2})runtime/,
221-
// loader: require.resolve('babel-loader'),
222-
// options: {
223-
// babelrc: false,
224-
// configFile: false,
225-
// compact: false,
226-
// presets: [
227-
// [
228-
// require.resolve('babel-preset-react-app/dependencies'),
229-
// {helpers: true},
230-
// ],
231-
// ],
232-
// cacheDirectory: true,
233-
// // See #6846 for context on why cacheCompression is disabled
234-
// cacheCompression: false,
235-
//
236-
// // If an error happens in a package, it's possible to be
237-
// // because it was compiled. Thus, we don't want the browser
238-
// // debugger to show the original code. Instead, the code
239-
// // being evaluated would be much more helpful.
240-
// sourceMaps: false,
241-
// },
242-
// },
24385
],
24486
},
24587
],

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "object-editor-react",
3-
"version": "1.1.0",
3+
"version": "1.1.0-rc0",
44
"description": "A React-based JSON object editor",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)