Update build tooling to same version as CRA2 has - includes node_modules babeling (#305)
This commit is contained in:
Родитель
a68801a816
Коммит
726936a1a3
|
@ -42,12 +42,12 @@ dotenvFiles.forEach(dotenvFile => {
|
||||||
|
|
||||||
// We support resolving modules according to `NODE_PATH`.
|
// We support resolving modules according to `NODE_PATH`.
|
||||||
// This lets you use absolute paths in imports inside large monorepos:
|
// This lets you use absolute paths in imports inside large monorepos:
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/253.
|
// https://github.com/facebook/create-react-app/issues/253.
|
||||||
// It works similar to `NODE_PATH` in Node itself:
|
// It works similar to `NODE_PATH` in Node itself:
|
||||||
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
|
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
|
||||||
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
|
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
|
||||||
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
|
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
|
// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
|
||||||
// We also resolve them to make sure all tools using them work consistently.
|
// We also resolve them to make sure all tools using them work consistently.
|
||||||
const appDirectory = fs.realpathSync(process.cwd());
|
const appDirectory = fs.realpathSync(process.cwd());
|
||||||
process.env.NODE_PATH = (process.env.NODE_PATH || '')
|
process.env.NODE_PATH = (process.env.NODE_PATH || '')
|
||||||
|
|
|
@ -5,20 +5,20 @@ const fs = require('fs');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
|
|
||||||
// Make sure any symlinks in the project folder are resolved:
|
// Make sure any symlinks in the project folder are resolved:
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/637
|
// https://github.com/facebook/create-react-app/issues/637
|
||||||
const appDirectory = fs.realpathSync(process.cwd());
|
const appDirectory = fs.realpathSync(process.cwd());
|
||||||
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
|
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
|
||||||
|
|
||||||
const envPublicUrl = process.env.PUBLIC_URL;
|
const envPublicUrl = process.env.PUBLIC_URL;
|
||||||
|
|
||||||
function ensureSlash(path, needsSlash) {
|
function ensureSlash(inputPath, needsSlash) {
|
||||||
const hasSlash = path.endsWith('/');
|
const hasSlash = inputPath.endsWith('/');
|
||||||
if (hasSlash && !needsSlash) {
|
if (hasSlash && !needsSlash) {
|
||||||
return path.substr(path, path.length - 1);
|
return inputPath.substr(0, inputPath.length - 1);
|
||||||
} else if (!hasSlash && needsSlash) {
|
} else if (!hasSlash && needsSlash) {
|
||||||
return `${path}/`;
|
return `${inputPath}/`;
|
||||||
} else {
|
} else {
|
||||||
return path;
|
return inputPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ function getServedPath(appPackageJson) {
|
||||||
// config after eject: we're in ./config/
|
// config after eject: we're in ./config/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
dotenv: resolveApp('.env'),
|
dotenv: resolveApp('.env'),
|
||||||
|
appPath: resolveApp('.'),
|
||||||
appBuild: resolveApp('build'),
|
appBuild: resolveApp('build'),
|
||||||
appPublic: resolveApp('public'),
|
appPublic: resolveApp('public'),
|
||||||
appHtml: resolveApp('public/index.html'),
|
appHtml: resolveApp('public/index.html'),
|
||||||
|
@ -49,6 +50,7 @@ module.exports = {
|
||||||
appSrc: resolveApp('src'),
|
appSrc: resolveApp('src'),
|
||||||
yarnLockFile: resolveApp('yarn.lock'),
|
yarnLockFile: resolveApp('yarn.lock'),
|
||||||
testsSetup: resolveApp('src/setupTests.js'),
|
testsSetup: resolveApp('src/setupTests.js'),
|
||||||
|
proxySetup: resolveApp('src/setupProxy.js'),
|
||||||
appNodeModules: resolveApp('node_modules'),
|
appNodeModules: resolveApp('node_modules'),
|
||||||
publicUrl: getPublicUrl(resolveApp('package.json')),
|
publicUrl: getPublicUrl(resolveApp('package.json')),
|
||||||
servedPath: getServedPath(resolveApp('package.json')),
|
servedPath: getServedPath(resolveApp('package.json')),
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
if (typeof Promise === 'undefined') {
|
|
||||||
// Rejection tracking prevents a common issue where React gets into an
|
|
||||||
// inconsistent state due to an error, but it gets swallowed by a Promise,
|
|
||||||
// and the user has no idea what causes React's erratic future behavior.
|
|
||||||
require('promise/lib/rejection-tracking').enable();
|
|
||||||
window.Promise = require('promise/lib/es6-extensions.js');
|
|
||||||
}
|
|
||||||
|
|
||||||
// fetch() polyfill for making API calls.
|
|
||||||
require('whatwg-fetch');
|
|
||||||
|
|
||||||
// Object.assign() is commonly used with React.
|
|
||||||
// It will use the native implementation if it's present and isn't buggy.
|
|
||||||
Object.assign = require('object-assign');
|
|
||||||
|
|
||||||
// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
|
|
||||||
// We don't polyfill it in the browser--this is user's responsibility.
|
|
||||||
if (process.env.NODE_ENV === 'test') {
|
|
||||||
require('raf').polyfill(global);
|
|
||||||
}
|
|
|
@ -1,16 +1,17 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const autoprefixer = require('autoprefixer');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
||||||
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
|
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
|
||||||
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
|
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
|
||||||
const eslintFormatter = require('react-dev-utils/eslintFormatter');
|
|
||||||
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
||||||
|
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
|
||||||
const getClientEnvironment = require('./env');
|
const getClientEnvironment = require('./env');
|
||||||
const paths = require('./paths');
|
const paths = require('./paths');
|
||||||
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||||
|
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
|
||||||
|
|
||||||
// Webpack uses `publicPath` to determine where the app is being served from.
|
// Webpack uses `publicPath` to determine where the app is being served from.
|
||||||
// In development, we always serve from the root. This makes config easier.
|
// In development, we always serve from the root. This makes config easier.
|
||||||
|
@ -22,19 +23,58 @@ const publicUrl = '';
|
||||||
// Get environment variables to inject into our app.
|
// Get environment variables to inject into our app.
|
||||||
const env = getClientEnvironment(publicUrl);
|
const env = getClientEnvironment(publicUrl);
|
||||||
|
|
||||||
|
// style files regexes
|
||||||
|
const cssRegex = /\.css$/;
|
||||||
|
const cssModuleRegex = /\.module\.css$/;
|
||||||
|
const sassRegex = /\.(scss|sass)$/;
|
||||||
|
const sassModuleRegex = /\.module\.(scss|sass)$/;
|
||||||
|
|
||||||
|
// common function to get style loaders
|
||||||
|
const getStyleLoaders = (cssOptions, preProcessor) => {
|
||||||
|
const loaders = [
|
||||||
|
require.resolve('style-loader'),
|
||||||
|
{
|
||||||
|
loader: require.resolve('css-loader'),
|
||||||
|
options: cssOptions,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Options for PostCSS as we reference these options twice
|
||||||
|
// Adds vendor prefixing based on your specified browser support in
|
||||||
|
// package.json
|
||||||
|
loader: require.resolve('postcss-loader'),
|
||||||
|
options: {
|
||||||
|
// Necessary for external CSS imports to work
|
||||||
|
// https://github.com/facebook/create-react-app/issues/2677
|
||||||
|
ident: 'postcss',
|
||||||
|
plugins: () => [
|
||||||
|
require('postcss-flexbugs-fixes'),
|
||||||
|
require('postcss-preset-env')({
|
||||||
|
autoprefixer: {
|
||||||
|
flexbox: 'no-2009',
|
||||||
|
},
|
||||||
|
stage: 3,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
if (preProcessor) {
|
||||||
|
loaders.push(require.resolve(preProcessor));
|
||||||
|
}
|
||||||
|
return loaders;
|
||||||
|
};
|
||||||
|
|
||||||
// This is the development configuration.
|
// This is the development configuration.
|
||||||
// It is focused on developer experience and fast rebuilds.
|
// It is focused on developer experience and fast rebuilds.
|
||||||
// The production configuration is different and lives in a separate file.
|
// The production configuration is different and lives in a separate file.
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
mode: 'development',
|
||||||
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
|
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
|
||||||
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.
|
// See the discussion in https://github.com/facebook/create-react-app/issues/343
|
||||||
devtool: 'cheap-module-source-map',
|
devtool: 'cheap-module-source-map',
|
||||||
// These are the "entry points" to our application.
|
// These are the "entry points" to our application.
|
||||||
// This means they will be the "root" imports that are included in JS bundle.
|
// This means they will be the "root" imports that are included in JS bundle.
|
||||||
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
|
|
||||||
entry: [
|
entry: [
|
||||||
// We ship a few polyfills by default:
|
|
||||||
require.resolve('./polyfills'),
|
|
||||||
// Include an alternative client for WebpackDevServer. A client's job is to
|
// Include an alternative client for WebpackDevServer. A client's job is to
|
||||||
// connect to WebpackDevServer by a socket and get notified about changes.
|
// connect to WebpackDevServer by a socket and get notified about changes.
|
||||||
// When you save a file, the client will either apply hot updates (in case
|
// When you save a file, the client will either apply hot updates (in case
|
||||||
|
@ -67,22 +107,34 @@ module.exports = {
|
||||||
devtoolModuleFilenameTemplate: info =>
|
devtoolModuleFilenameTemplate: info =>
|
||||||
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
|
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
// Automatically split vendor and commons
|
||||||
|
// https://twitter.com/wSokra/status/969633336732905474
|
||||||
|
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
|
||||||
|
splitChunks: {
|
||||||
|
chunks: 'all',
|
||||||
|
name: false,
|
||||||
|
},
|
||||||
|
// Keep the runtime chunk seperated to enable long term caching
|
||||||
|
// https://twitter.com/wSokra/status/969679223278505985
|
||||||
|
runtimeChunk: true,
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
// This allows you to set a fallback for where Webpack should look for modules.
|
// This allows you to set a fallback for where Webpack should look for modules.
|
||||||
// We placed these paths second because we want `node_modules` to "win"
|
// We placed these paths second because we want `node_modules` to "win"
|
||||||
// if there are any conflicts. This matches Node resolution mechanism.
|
// if there are any conflicts. This matches Node resolution mechanism.
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/253
|
// https://github.com/facebook/create-react-app/issues/253
|
||||||
modules: ['node_modules', paths.appNodeModules].concat(
|
modules: ['node_modules'].concat(
|
||||||
// It is guaranteed to exist because we tweak it in `env.js`
|
// It is guaranteed to exist because we tweak it in `env.js`
|
||||||
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
|
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
|
||||||
),
|
),
|
||||||
// These are the reasonable defaults supported by the Node ecosystem.
|
// These are the reasonable defaults supported by the Node ecosystem.
|
||||||
// We also include JSX as a common component filename extension to support
|
// We also include JSX as a common component filename extension to support
|
||||||
// some tools, although we do not recommend using it, see:
|
// some tools, although we do not recommend using it, see:
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/290
|
// https://github.com/facebook/create-react-app/issues/290
|
||||||
// `web` extension prefixes have been added for better support
|
// `web` extension prefixes have been added for better support
|
||||||
// for React Native Web.
|
// for React Native Web.
|
||||||
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
|
extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx'],
|
||||||
alias: {
|
alias: {
|
||||||
|
|
||||||
// Support React Native Web
|
// Support React Native Web
|
||||||
|
@ -101,19 +153,18 @@ module.exports = {
|
||||||
module: {
|
module: {
|
||||||
strictExportPresence: true,
|
strictExportPresence: true,
|
||||||
rules: [
|
rules: [
|
||||||
// TODO: Disable require.ensure as it's not a standard language feature.
|
// Disable require.ensure as it's not a standard language feature.
|
||||||
// We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176.
|
{ parser: { requireEnsure: false } },
|
||||||
// { parser: { requireEnsure: false } },
|
|
||||||
|
|
||||||
// First, run the linter.
|
// First, run the linter.
|
||||||
// It's important to do this before Babel processes the JS.
|
// It's important to do this before Babel processes the JS.
|
||||||
{
|
{
|
||||||
test: /\.(js|jsx|mjs)$/,
|
test: /\.(js|jsx)$/,
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
options: {
|
options: {
|
||||||
formatter: eslintFormatter,
|
formatter: require.resolve('react-dev-utils/eslintFormatter'),
|
||||||
eslintPath: require.resolve('eslint'),
|
eslintPath: require.resolve('eslint'),
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -138,54 +189,135 @@ module.exports = {
|
||||||
name: 'static/media/[name].[hash:8].[ext]',
|
name: 'static/media/[name].[hash:8].[ext]',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Process JS with Babel.
|
// Process application JS with Babel.
|
||||||
|
// The preset includes JSX, Flow, and some ESnext features.
|
||||||
{
|
{
|
||||||
test: /\.(js|jsx|mjs)$/,
|
test: /\.(js|jsx)$/,
|
||||||
include: paths.appSrc,
|
include: paths.appSrc,
|
||||||
loader: require.resolve('babel-loader'),
|
use: [
|
||||||
options: {
|
// This loader parallelizes code compilation, it is optional but
|
||||||
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
// improves compile time on larger projects
|
||||||
// It enables caching results in ./node_modules/.cache/babel-loader/
|
{
|
||||||
// directory for faster rebuilds.
|
loader: require.resolve('thread-loader'),
|
||||||
cacheDirectory: true,
|
options: {
|
||||||
},
|
poolTimeout: Infinity, // keep workers alive for more effective watch mode
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// We need to use our own loader until `babel-loader` supports
|
||||||
|
// customization
|
||||||
|
// https://github.com/babel/babel-loader/pull/687
|
||||||
|
loader: require.resolve('babel-preset-react-app/loader'),
|
||||||
|
options: {
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
require.resolve('babel-plugin-named-asset-import'),
|
||||||
|
{
|
||||||
|
loaderMap: {
|
||||||
|
svg: {
|
||||||
|
ReactComponent:
|
||||||
|
'@svgr/webpack?-prettier,-svgo![path]',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
||||||
|
// It enables caching results in ./node_modules/.cache/babel-loader/
|
||||||
|
// directory for faster rebuilds.
|
||||||
|
cacheDirectory: true,
|
||||||
|
// Don't waste time on Gzipping the cache
|
||||||
|
cacheCompression: false,
|
||||||
|
highlightCode: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// Process any JS outside of the app with Babel.
|
||||||
|
// Unlike the application JS, we only compile the standard ES features.
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /@babel(?:\/|\\{1,2})runtime/,
|
||||||
|
use: [
|
||||||
|
// This loader parallelizes code compilation, it is optional but
|
||||||
|
// improves compile time on larger projects
|
||||||
|
{
|
||||||
|
loader: require.resolve('thread-loader'),
|
||||||
|
options: {
|
||||||
|
poolTimeout: Infinity, // keep workers alive for more effective watch mode
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: require.resolve('babel-loader'),
|
||||||
|
options: {
|
||||||
|
babelrc: false,
|
||||||
|
compact: false,
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
require.resolve('babel-preset-react-app/dependencies'),
|
||||||
|
{ helpers: true },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
cacheDirectory: true,
|
||||||
|
// Don't waste time on Gzipping the cache
|
||||||
|
cacheCompression: false,
|
||||||
|
|
||||||
|
highlightCode: true,
|
||||||
|
// If an error happens in a package, it's possible to be
|
||||||
|
// because it was compiled. Thus, we don't want the browser
|
||||||
|
// debugger to show the original code. Instead, the code
|
||||||
|
// being evaluated would be much more helpful.
|
||||||
|
sourceMaps: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
// "postcss" loader applies autoprefixer to our CSS.
|
// "postcss" loader applies autoprefixer to our CSS.
|
||||||
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
||||||
// "style" loader turns CSS into JS modules that inject <style> tags.
|
// "style" loader turns CSS into JS modules that inject <style> tags.
|
||||||
// In production, we use a plugin to extract that CSS to a file, but
|
// In production, we use a plugin to extract that CSS to a file, but
|
||||||
// in development "style" loader enables hot editing of CSS.
|
// in development "style" loader enables hot editing of CSS.
|
||||||
|
// By default we support CSS Modules with the extension .module.css
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: cssRegex,
|
||||||
use: [
|
exclude: cssModuleRegex,
|
||||||
require.resolve('style-loader'),
|
use: getStyleLoaders({
|
||||||
|
importLoaders: 1,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
|
||||||
|
// using the extension .module.css
|
||||||
|
{
|
||||||
|
test: cssModuleRegex,
|
||||||
|
use: getStyleLoaders({
|
||||||
|
importLoaders: 1,
|
||||||
|
modules: true,
|
||||||
|
getLocalIdent: getCSSModuleLocalIdent,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
// Opt-in support for SASS (using .scss or .sass extensions).
|
||||||
|
// Chains the sass-loader with the css-loader and the style-loader
|
||||||
|
// to immediately apply all styles to the DOM.
|
||||||
|
// By default we support SASS Modules with the
|
||||||
|
// extensions .module.scss or .module.sass
|
||||||
|
{
|
||||||
|
test: sassRegex,
|
||||||
|
exclude: sassModuleRegex,
|
||||||
|
use: getStyleLoaders({ importLoaders: 2 }, 'sass-loader'),
|
||||||
|
},
|
||||||
|
// Adds support for CSS Modules, but using SASS
|
||||||
|
// using the extension .module.scss or .module.sass
|
||||||
|
{
|
||||||
|
test: sassModuleRegex,
|
||||||
|
use: getStyleLoaders(
|
||||||
{
|
{
|
||||||
loader: require.resolve('css-loader'),
|
importLoaders: 2,
|
||||||
options: {
|
modules: true,
|
||||||
importLoaders: 1,
|
getLocalIdent: getCSSModuleLocalIdent,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
'sass-loader'
|
||||||
loader: require.resolve('postcss-loader'),
|
),
|
||||||
options: {
|
|
||||||
// Necessary for external CSS imports to work
|
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/2677
|
|
||||||
ident: 'postcss',
|
|
||||||
plugins: () => [
|
|
||||||
require('postcss-flexbugs-fixes'),
|
|
||||||
autoprefixer({
|
|
||||||
browsers: [
|
|
||||||
'>1%',
|
|
||||||
'last 4 versions',
|
|
||||||
'Firefox ESR',
|
|
||||||
'not ie < 9', // React doesn't support IE8 anyway
|
|
||||||
],
|
|
||||||
flexbox: 'no-2009',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
// "file" loader makes sure those assets get served by WebpackDevServer.
|
// "file" loader makes sure those assets get served by WebpackDevServer.
|
||||||
// When you `import` an asset, you get its (virtual) filename.
|
// When you `import` an asset, you get its (virtual) filename.
|
||||||
|
@ -194,10 +326,10 @@ module.exports = {
|
||||||
// that fall through the other loaders.
|
// that fall through the other loaders.
|
||||||
{
|
{
|
||||||
// Exclude `js` files to keep "css" loader working as it injects
|
// Exclude `js` files to keep "css" loader working as it injects
|
||||||
// its runtime that would otherwise processed through "file" loader.
|
// its runtime that would otherwise be processed through "file" loader.
|
||||||
// Also exclude `html` and `json` extensions so they get processed
|
// Also exclude `html` and `json` extensions so they get processed
|
||||||
// by webpacks internal loaders.
|
// by webpacks internal loaders.
|
||||||
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
|
exclude: [/\.(js|jsx)$/, /\.html$/, /\.json$/],
|
||||||
loader: require.resolve('file-loader'),
|
loader: require.resolve('file-loader'),
|
||||||
options: {
|
options: {
|
||||||
name: 'static/media/[name].[hash:8].[ext]',
|
name: 'static/media/[name].[hash:8].[ext]',
|
||||||
|
@ -210,18 +342,16 @@ module.exports = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
// Makes some environment variables available in index.html.
|
|
||||||
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
|
|
||||||
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
|
||||||
// In development, this will be an empty string.
|
|
||||||
new InterpolateHtmlPlugin(env.raw),
|
|
||||||
// Generates an `index.html` file with the <script> injected.
|
// Generates an `index.html` file with the <script> injected.
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
inject: true,
|
inject: true,
|
||||||
template: paths.appHtml,
|
template: paths.appHtml,
|
||||||
}),
|
}),
|
||||||
// Add module names to factory functions so they appear in browser profiler.
|
// Makes some environment variables available in index.html.
|
||||||
new webpack.NamedModulesPlugin(),
|
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
|
||||||
|
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
||||||
|
// In development, this will be an empty string.
|
||||||
|
new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
|
||||||
// Makes some environment variables available to the JS code, for example:
|
// Makes some environment variables available to the JS code, for example:
|
||||||
// if (process.env.NODE_ENV === 'development') { ... }. See `./env.js`.
|
// if (process.env.NODE_ENV === 'development') { ... }. See `./env.js`.
|
||||||
new webpack.DefinePlugin(env.stringified),
|
new webpack.DefinePlugin(env.stringified),
|
||||||
|
@ -229,12 +359,12 @@ module.exports = {
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
// Watcher doesn't work well if you mistype casing in a path so we use
|
// Watcher doesn't work well if you mistype casing in a path so we use
|
||||||
// a plugin that prints an error when you attempt to do this.
|
// a plugin that prints an error when you attempt to do this.
|
||||||
// See https://github.com/facebookincubator/create-react-app/issues/240
|
// See https://github.com/facebook/create-react-app/issues/240
|
||||||
new CaseSensitivePathsPlugin(),
|
new CaseSensitivePathsPlugin(),
|
||||||
// If you require a missing module and then `npm install` it, you still have
|
// If you require a missing module and then `npm install` it, you still have
|
||||||
// to restart the development server for Webpack to discover it. This plugin
|
// to restart the development server for Webpack to discover it. This plugin
|
||||||
// makes the discovery automatic so you don't have to restart.
|
// makes the discovery automatic so you don't have to restart.
|
||||||
// See https://github.com/facebookincubator/create-react-app/issues/186
|
// See https://github.com/facebook/create-react-app/issues/186
|
||||||
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
|
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
|
||||||
// Moment.js is an extremely popular library that bundles large locale files
|
// Moment.js is an extremely popular library that bundles large locale files
|
||||||
// by default due to how Webpack interprets its code. This is a practical
|
// by default due to how Webpack interprets its code. This is a practical
|
||||||
|
@ -242,7 +372,15 @@ module.exports = {
|
||||||
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
|
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
|
||||||
// You can remove this if you don't use Moment.js:
|
// You can remove this if you don't use Moment.js:
|
||||||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
||||||
|
// Generate a manifest file which contains a mapping of all asset filenames
|
||||||
|
// to their corresponding output file so that tools can pick it up without
|
||||||
|
// having to parse `index.html`.
|
||||||
|
new ManifestPlugin({
|
||||||
|
fileName: 'asset-manifest.json',
|
||||||
|
publicPath: publicPath,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
// Some libraries import Node modules but don't use them in the browser.
|
// Some libraries import Node modules but don't use them in the browser.
|
||||||
// Tell Webpack to provide empty mocks for them so importing them works.
|
// Tell Webpack to provide empty mocks for them so importing them works.
|
||||||
node: {
|
node: {
|
||||||
|
@ -252,10 +390,7 @@ module.exports = {
|
||||||
tls: 'empty',
|
tls: 'empty',
|
||||||
child_process: 'empty',
|
child_process: 'empty',
|
||||||
},
|
},
|
||||||
// Turn off performance hints during development because we don't do any
|
// Turn off performance processing because we utilize
|
||||||
// splitting or minification in interest of speed. These warnings become
|
// our own hints via the FileSizeReporter
|
||||||
// cumbersome.
|
performance: false,
|
||||||
performance: {
|
|
||||||
hints: false,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const autoprefixer = require('autoprefixer');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
|
||||||
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||||||
|
const safePostCssParser = require('postcss-safe-parser');
|
||||||
const ManifestPlugin = require('webpack-manifest-plugin');
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||||
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
|
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
|
||||||
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
||||||
const eslintFormatter = require('react-dev-utils/eslintFormatter');
|
|
||||||
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
||||||
|
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
|
||||||
const paths = require('./paths');
|
const paths = require('./paths');
|
||||||
const getClientEnvironment = require('./env');
|
const getClientEnvironment = require('./env');
|
||||||
|
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
|
||||||
|
|
||||||
// Webpack uses `publicPath` to determine where the app is being served from.
|
// Webpack uses `publicPath` to determine where the app is being served from.
|
||||||
// It requires a trailing slash, or the file assets will get an incorrect path.
|
// It requires a trailing slash, or the file assets will get an incorrect path.
|
||||||
const publicPath = paths.servedPath;
|
const publicPath = paths.servedPath;
|
||||||
// Some apps do not use client-side routing with pushState.
|
|
||||||
// For these, "homepage" can be set to "." to enable relative asset paths.
|
|
||||||
const shouldUseRelativeAssetPaths = publicPath === './';
|
|
||||||
// Source maps are resource heavy and can cause out of memory issue for large source files.
|
// Source maps are resource heavy and can cause out of memory issue for large source files.
|
||||||
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
|
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
|
||||||
// `publicUrl` is just like `publicPath`, but we will provide it to our app
|
// `publicUrl` is just like `publicPath`, but we will provide it to our app
|
||||||
|
@ -34,29 +35,65 @@ if (env.stringified['process.env'].NODE_ENV !== '"production"') {
|
||||||
throw new Error('Production builds must have NODE_ENV=production.');
|
throw new Error('Production builds must have NODE_ENV=production.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: defined here because it will be used more than once.
|
// style files regexes
|
||||||
const cssFilename = 'static/css/[name].[contenthash:8].css';
|
const cssRegex = /\.css$/;
|
||||||
|
const cssModuleRegex = /\.module\.css$/;
|
||||||
|
const sassRegex = /\.(scss|sass)$/;
|
||||||
|
const sassModuleRegex = /\.module\.(scss|sass)$/;
|
||||||
|
|
||||||
// ExtractTextPlugin expects the build output to be flat.
|
// common function to get style loaders
|
||||||
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
|
const getStyleLoaders = (cssOptions, preProcessor) => {
|
||||||
// However, our output is structured with css, js and media folders.
|
const loaders = [
|
||||||
// To have this structure working with relative paths, we have to use custom options.
|
MiniCssExtractPlugin.loader,
|
||||||
const extractTextPluginOptions = shouldUseRelativeAssetPaths
|
{
|
||||||
? // Making sure that the publicPath goes back to to build folder.
|
loader: require.resolve('css-loader'),
|
||||||
{ publicPath: Array(cssFilename.split('/').length).join('../') }
|
options: cssOptions,
|
||||||
: {};
|
},
|
||||||
|
{
|
||||||
|
// Options for PostCSS as we reference these options twice
|
||||||
|
// Adds vendor prefixing based on your specified browser support in
|
||||||
|
// package.json
|
||||||
|
loader: require.resolve('postcss-loader'),
|
||||||
|
options: {
|
||||||
|
// Necessary for external CSS imports to work
|
||||||
|
// https://github.com/facebook/create-react-app/issues/2677
|
||||||
|
ident: 'postcss',
|
||||||
|
plugins: () => [
|
||||||
|
require('postcss-flexbugs-fixes'),
|
||||||
|
require('postcss-preset-env')({
|
||||||
|
autoprefixer: {
|
||||||
|
flexbox: 'no-2009',
|
||||||
|
},
|
||||||
|
stage: 3,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
sourceMap: shouldUseSourceMap,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
if (preProcessor) {
|
||||||
|
loaders.push({
|
||||||
|
loader: require.resolve(preProcessor),
|
||||||
|
options: {
|
||||||
|
sourceMap: shouldUseSourceMap,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return loaders;
|
||||||
|
};
|
||||||
|
|
||||||
// This is the production configuration.
|
// This is the production configuration.
|
||||||
// It compiles slowly and is focused on producing a fast and minimal bundle.
|
// It compiles slowly and is focused on producing a fast and minimal bundle.
|
||||||
// The development configuration is different and lives in a separate file.
|
// The development configuration is different and lives in a separate file.
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
mode: 'production',
|
||||||
// Don't attempt to continue if there are any errors.
|
// Don't attempt to continue if there are any errors.
|
||||||
bail: true,
|
bail: true,
|
||||||
// We generate sourcemaps in production. This is slow but gives good results.
|
// We generate sourcemaps in production. This is slow but gives good results.
|
||||||
// You can exclude the *.map files from the build during deployment.
|
// You can exclude the *.map files from the build during deployment.
|
||||||
devtool: shouldUseSourceMap ? 'source-map' : false,
|
devtool: shouldUseSourceMap ? 'source-map' : false,
|
||||||
// In production, we only want to load the polyfills and the app code.
|
// In production, we only want to load the app code.
|
||||||
entry: [require.resolve('./polyfills'), paths.appIndexJs],
|
entry: [paths.appIndexJs],
|
||||||
output: {
|
output: {
|
||||||
// The build folder.
|
// The build folder.
|
||||||
path: paths.appBuild,
|
path: paths.appBuild,
|
||||||
|
@ -73,24 +110,78 @@ module.exports = {
|
||||||
.relative(paths.appSrc, info.absoluteResourcePath)
|
.relative(paths.appSrc, info.absoluteResourcePath)
|
||||||
.replace(/\\/g, '/'),
|
.replace(/\\/g, '/'),
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
minimizer: [
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
parse: {
|
||||||
|
// we want terser to parse ecma 8 code. However, we don't want it
|
||||||
|
// to apply any minfication steps that turns valid ecma 5 code
|
||||||
|
// into invalid ecma 5 code. This is why the 'compress' and 'output'
|
||||||
|
// sections only apply transformations that are ecma 5 safe
|
||||||
|
// https://github.com/facebook/create-react-app/pull/4234
|
||||||
|
ecma: 8,
|
||||||
|
},
|
||||||
|
compress: {
|
||||||
|
ecma: 5,
|
||||||
|
warnings: false,
|
||||||
|
// Disabled because of an issue with Uglify breaking seemingly valid code:
|
||||||
|
// https://github.com/facebook/create-react-app/issues/2376
|
||||||
|
// Pending further investigation:
|
||||||
|
// https://github.com/mishoo/UglifyJS2/issues/2011
|
||||||
|
comparisons: false,
|
||||||
|
},
|
||||||
|
mangle: {
|
||||||
|
safari10: true,
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
ecma: 5,
|
||||||
|
comments: false,
|
||||||
|
// Turned on because emoji and regex is not minified properly using default
|
||||||
|
// https://github.com/facebook/create-react-app/issues/2488
|
||||||
|
ascii_only: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// Use multi-process parallel running to improve the build speed
|
||||||
|
// Default number of concurrent runs: os.cpus().length - 1
|
||||||
|
parallel: true,
|
||||||
|
// Enable file caching
|
||||||
|
cache: true,
|
||||||
|
sourceMap: shouldUseSourceMap,
|
||||||
|
}),
|
||||||
|
new OptimizeCSSAssetsPlugin({
|
||||||
|
cssProcessorOptions: { parser: safePostCssParser },
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
// Automatically split vendor and commons
|
||||||
|
// https://twitter.com/wSokra/status/969633336732905474
|
||||||
|
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
|
||||||
|
splitChunks: {
|
||||||
|
chunks: 'all',
|
||||||
|
name: false,
|
||||||
|
},
|
||||||
|
// Keep the runtime chunk seperated to enable long term caching
|
||||||
|
// https://twitter.com/wSokra/status/969679223278505985
|
||||||
|
runtimeChunk: true,
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
// This allows you to set a fallback for where Webpack should look for modules.
|
// This allows you to set a fallback for where Webpack should look for modules.
|
||||||
// We placed these paths second because we want `node_modules` to "win"
|
// We placed these paths second because we want `node_modules` to "win"
|
||||||
// if there are any conflicts. This matches Node resolution mechanism.
|
// if there are any conflicts. This matches Node resolution mechanism.
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/253
|
// https://github.com/facebook/create-react-app/issues/253
|
||||||
modules: ['node_modules', paths.appNodeModules].concat(
|
modules: ['node_modules'].concat(
|
||||||
// It is guaranteed to exist because we tweak it in `env.js`
|
// It is guaranteed to exist because we tweak it in `env.js`
|
||||||
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
|
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
|
||||||
),
|
),
|
||||||
// These are the reasonable defaults supported by the Node ecosystem.
|
// These are the reasonable defaults supported by the Node ecosystem.
|
||||||
// We also include JSX as a common component filename extension to support
|
// We also include JSX as a common component filename extension to support
|
||||||
// some tools, although we do not recommend using it, see:
|
// some tools, although we do not recommend using it, see:
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/290
|
// https://github.com/facebook/create-react-app/issues/290
|
||||||
// `web` extension prefixes have been added for better support
|
// `web` extension prefixes have been added for better support
|
||||||
// for React Native Web.
|
// for React Native Web.
|
||||||
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
|
extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx'],
|
||||||
alias: {
|
alias: {
|
||||||
|
|
||||||
// Support React Native Web
|
// Support React Native Web
|
||||||
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
|
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
|
||||||
'react-native': 'react-native-web',
|
'react-native': 'react-native-web',
|
||||||
|
@ -107,21 +198,20 @@ module.exports = {
|
||||||
module: {
|
module: {
|
||||||
strictExportPresence: true,
|
strictExportPresence: true,
|
||||||
rules: [
|
rules: [
|
||||||
// TODO: Disable require.ensure as it's not a standard language feature.
|
// Disable require.ensure as it's not a standard language feature.
|
||||||
// We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176.
|
{ parser: { requireEnsure: false } },
|
||||||
// { parser: { requireEnsure: false } },
|
|
||||||
|
|
||||||
// First, run the linter.
|
// First, run the linter.
|
||||||
// It's important to do this before Babel processes the JS.
|
// It's important to do this before Babel processes the JS.
|
||||||
{
|
{
|
||||||
test: /\.(js|jsx|mjs)$/,
|
test: /\.(js|jsx)$/,
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
options: {
|
options: {
|
||||||
formatter: eslintFormatter,
|
formatter: require.resolve('react-dev-utils/eslintFormatter'),
|
||||||
eslintPath: require.resolve('eslint'),
|
eslintPath: require.resolve('eslint'),
|
||||||
|
|
||||||
},
|
},
|
||||||
loader: require.resolve('eslint-loader'),
|
loader: require.resolve('eslint-loader'),
|
||||||
},
|
},
|
||||||
|
@ -143,74 +233,131 @@ module.exports = {
|
||||||
name: 'static/media/[name].[hash:8].[ext]',
|
name: 'static/media/[name].[hash:8].[ext]',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Process JS with Babel.
|
// Process application JS with Babel.
|
||||||
|
// The preset includes JSX, Flow, and some ESnext features.
|
||||||
{
|
{
|
||||||
test: /\.(js|jsx|mjs)$/,
|
test: /\.(js|jsx)$/,
|
||||||
include: paths.appSrc,
|
include: paths.appSrc,
|
||||||
loader: require.resolve('babel-loader'),
|
use: [
|
||||||
options: {
|
// This loader parallelizes code compilation, it is optional but
|
||||||
|
// improves compile time on larger projects
|
||||||
compact: true,
|
require.resolve('thread-loader'),
|
||||||
},
|
{
|
||||||
|
// We need to use our own loader until `babel-loader` supports
|
||||||
|
// customization
|
||||||
|
// https://github.com/babel/babel-loader/pull/687
|
||||||
|
loader: require.resolve('babel-preset-react-app/loader'),
|
||||||
|
options: {
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
require.resolve('babel-plugin-named-asset-import'),
|
||||||
|
{
|
||||||
|
loaderMap: {
|
||||||
|
svg: {
|
||||||
|
ReactComponent:
|
||||||
|
'@svgr/webpack?-prettier,-svgo![path]',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
cacheDirectory: true,
|
||||||
|
// Save disk space when time isn't as important
|
||||||
|
cacheCompression: true,
|
||||||
|
compact: true,
|
||||||
|
highlightCode: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// Process any JS outside of the app with Babel.
|
||||||
|
// Unlike the application JS, we only compile the standard ES features.
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /@babel(?:\/|\\{1,2})runtime/,
|
||||||
|
use: [
|
||||||
|
// This loader parallelizes code compilation, it is optional but
|
||||||
|
// improves compile time on larger projects
|
||||||
|
require.resolve('thread-loader'),
|
||||||
|
{
|
||||||
|
loader: require.resolve('babel-loader'),
|
||||||
|
options: {
|
||||||
|
babelrc: false,
|
||||||
|
compact: false,
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
require.resolve('babel-preset-react-app/dependencies'),
|
||||||
|
{ helpers: true },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
cacheDirectory: true,
|
||||||
|
// Save disk space when time isn't as important
|
||||||
|
cacheCompression: true,
|
||||||
|
|
||||||
|
highlightCode: true,
|
||||||
|
// If an error happens in a package, it's possible to be
|
||||||
|
// because it was compiled. Thus, we don't want the browser
|
||||||
|
// debugger to show the original code. Instead, the code
|
||||||
|
// being evaluated would be much more helpful.
|
||||||
|
sourceMaps: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
// The notation here is somewhat confusing.
|
|
||||||
// "postcss" loader applies autoprefixer to our CSS.
|
// "postcss" loader applies autoprefixer to our CSS.
|
||||||
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
||||||
// "style" loader normally turns CSS into JS modules injecting <style>,
|
// `MiniCSSExtractPlugin` extracts styles into CSS
|
||||||
// but unlike in development configuration, we do something different.
|
// files. If you use code splitting, async bundles will have their own separate CSS chunk file.
|
||||||
// `ExtractTextPlugin` first applies the "postcss" and "css" loaders
|
// By default we support CSS Modules with the extension .module.css
|
||||||
// (second argument), then grabs the result CSS and puts it into a
|
|
||||||
// separate file in our build process. This way we actually ship
|
|
||||||
// a single CSS file in production instead of JS code injecting <style>
|
|
||||||
// tags. If you use code splitting, however, any async bundles will still
|
|
||||||
// use the "style" loader inside the async code so CSS from them won't be
|
|
||||||
// in the main CSS file.
|
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: cssRegex,
|
||||||
loader: ExtractTextPlugin.extract(
|
exclude: cssModuleRegex,
|
||||||
Object.assign(
|
loader: getStyleLoaders({
|
||||||
{
|
importLoaders: 1,
|
||||||
fallback: {
|
sourceMap: shouldUseSourceMap,
|
||||||
loader: require.resolve('style-loader'),
|
}),
|
||||||
options: {
|
},
|
||||||
hmr: false,
|
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
|
||||||
},
|
// using the extension .module.css
|
||||||
},
|
{
|
||||||
use: [
|
test: cssModuleRegex,
|
||||||
{
|
loader: getStyleLoaders({
|
||||||
loader: require.resolve('css-loader'),
|
importLoaders: 1,
|
||||||
options: {
|
sourceMap: shouldUseSourceMap,
|
||||||
importLoaders: 1,
|
modules: true,
|
||||||
minimize: true,
|
getLocalIdent: getCSSModuleLocalIdent,
|
||||||
sourceMap: shouldUseSourceMap,
|
}),
|
||||||
},
|
},
|
||||||
},
|
// Opt-in support for SASS. The logic here is somewhat similar
|
||||||
{
|
// as in the CSS routine, except that "sass-loader" runs first
|
||||||
loader: require.resolve('postcss-loader'),
|
// to compile SASS files into CSS.
|
||||||
options: {
|
// By default we support SASS Modules with the
|
||||||
// Necessary for external CSS imports to work
|
// extensions .module.scss or .module.sass
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/2677
|
{
|
||||||
ident: 'postcss',
|
test: sassRegex,
|
||||||
plugins: () => [
|
exclude: sassModuleRegex,
|
||||||
require('postcss-flexbugs-fixes'),
|
loader: getStyleLoaders(
|
||||||
autoprefixer({
|
{
|
||||||
browsers: [
|
importLoaders: 2,
|
||||||
'>1%',
|
sourceMap: shouldUseSourceMap,
|
||||||
'last 4 versions',
|
},
|
||||||
'Firefox ESR',
|
'sass-loader'
|
||||||
'not ie < 9', // React doesn't support IE8 anyway
|
),
|
||||||
],
|
},
|
||||||
flexbox: 'no-2009',
|
// Adds support for CSS Modules, but using SASS
|
||||||
}),
|
// using the extension .module.scss or .module.sass
|
||||||
],
|
{
|
||||||
},
|
test: sassModuleRegex,
|
||||||
},
|
loader: getStyleLoaders(
|
||||||
],
|
{
|
||||||
},
|
importLoaders: 2,
|
||||||
extractTextPluginOptions
|
sourceMap: shouldUseSourceMap,
|
||||||
)
|
modules: true,
|
||||||
|
getLocalIdent: getCSSModuleLocalIdent,
|
||||||
|
},
|
||||||
|
'sass-loader'
|
||||||
),
|
),
|
||||||
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
|
|
||||||
},
|
},
|
||||||
// "file" loader makes sure assets end up in the `build` folder.
|
// "file" loader makes sure assets end up in the `build` folder.
|
||||||
// When you `import` an asset, you get its filename.
|
// When you `import` an asset, you get its filename.
|
||||||
|
@ -219,10 +366,10 @@ module.exports = {
|
||||||
{
|
{
|
||||||
loader: require.resolve('file-loader'),
|
loader: require.resolve('file-loader'),
|
||||||
// Exclude `js` files to keep "css" loader working as it injects
|
// Exclude `js` files to keep "css" loader working as it injects
|
||||||
// it's runtime that would otherwise processed through "file" loader.
|
// it's runtime that would otherwise be processed through "file" loader.
|
||||||
// Also exclude `html` and `json` extensions so they get processed
|
// Also exclude `html` and `json` extensions so they get processed
|
||||||
// by webpacks internal loaders.
|
// by webpacks internal loaders.
|
||||||
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
|
exclude: [/\.(js|jsx)$/, /\.html$/, /\.json$/],
|
||||||
options: {
|
options: {
|
||||||
name: 'static/media/[name].[hash:8].[ext]',
|
name: 'static/media/[name].[hash:8].[ext]',
|
||||||
},
|
},
|
||||||
|
@ -234,12 +381,6 @@ module.exports = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
// Makes some environment variables available in index.html.
|
|
||||||
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
|
|
||||||
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
|
||||||
// In production, it will be an empty string unless you specify "homepage"
|
|
||||||
// in `package.json`, in which case it will be the pathname of that URL.
|
|
||||||
new InterpolateHtmlPlugin(env.raw),
|
|
||||||
// Generates an `index.html` file with the <script> injected.
|
// Generates an `index.html` file with the <script> injected.
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
inject: true,
|
inject: true,
|
||||||
|
@ -257,41 +398,32 @@ module.exports = {
|
||||||
minifyURLs: true,
|
minifyURLs: true,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
// Inlines the webpack runtime script. This script is too small to warrant
|
||||||
|
// a network request.
|
||||||
|
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime~.+[.]js/]),
|
||||||
|
// Makes some environment variables available in index.html.
|
||||||
|
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
|
||||||
|
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
||||||
|
// In production, it will be an empty string unless you specify "homepage"
|
||||||
|
// in `package.json`, in which case it will be the pathname of that URL.
|
||||||
|
new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
|
||||||
// Makes some environment variables available to the JS code, for example:
|
// Makes some environment variables available to the JS code, for example:
|
||||||
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
|
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
|
||||||
// It is absolutely essential that NODE_ENV was set to production here.
|
// It is absolutely essential that NODE_ENV was set to production here.
|
||||||
// Otherwise React will be compiled in the very slow development mode.
|
// Otherwise React will be compiled in the very slow development mode.
|
||||||
new webpack.DefinePlugin(env.stringified),
|
new webpack.DefinePlugin(env.stringified),
|
||||||
// Minify the code.
|
new MiniCssExtractPlugin({
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
// Options similar to the same options in webpackOptions.output
|
||||||
compress: {
|
// both options are optional
|
||||||
warnings: false,
|
filename: 'static/css/[name].[contenthash:8].css',
|
||||||
// Disabled because of an issue with Uglify breaking seemingly valid code:
|
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/2376
|
|
||||||
// Pending further investigation:
|
|
||||||
// https://github.com/mishoo/UglifyJS2/issues/2011
|
|
||||||
comparisons: false,
|
|
||||||
},
|
|
||||||
mangle: {
|
|
||||||
safari10: true,
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
comments: false,
|
|
||||||
// Turned on because emoji and regex is not minified properly using default
|
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/2488
|
|
||||||
ascii_only: true,
|
|
||||||
},
|
|
||||||
sourceMap: shouldUseSourceMap,
|
|
||||||
}),
|
|
||||||
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
|
|
||||||
new ExtractTextPlugin({
|
|
||||||
filename: cssFilename,
|
|
||||||
}),
|
}),
|
||||||
// Generate a manifest file which contains a mapping of all asset filenames
|
// Generate a manifest file which contains a mapping of all asset filenames
|
||||||
// to their corresponding output file so that tools can pick it up without
|
// to their corresponding output file so that tools can pick it up without
|
||||||
// having to parse `index.html`.
|
// having to parse `index.html`.
|
||||||
new ManifestPlugin({
|
new ManifestPlugin({
|
||||||
fileName: 'asset-manifest.json',
|
fileName: 'asset-manifest.json',
|
||||||
|
publicPath: publicPath,
|
||||||
}),
|
}),
|
||||||
// Generate a service worker script that will precache, and keep up to date,
|
// Generate a service worker script that will precache, and keep up to date,
|
||||||
// the HTML & assets that are part of the Webpack build.
|
// the HTML & assets that are part of the Webpack build.
|
||||||
|
@ -309,7 +441,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
if (message.indexOf('Skipping static resource') === 0) {
|
if (message.indexOf('Skipping static resource') === 0) {
|
||||||
// This message obscures real errors so we ignore it.
|
// This message obscures real errors so we ignore it.
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/2612
|
// https://github.com/facebook/create-react-app/issues/2612
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(message);
|
console.log(message);
|
||||||
|
@ -322,6 +454,12 @@ module.exports = {
|
||||||
navigateFallbackWhitelist: [/^(?!\/__).*/],
|
navigateFallbackWhitelist: [/^(?!\/__).*/],
|
||||||
// Don't precache sourcemaps (they're large) and build asset manifest:
|
// Don't precache sourcemaps (they're large) and build asset manifest:
|
||||||
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
|
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
|
||||||
|
// Disabling skipWaiting ensures better compatibility with web apps that
|
||||||
|
// use deferred or lazy-loading, at the expense of "keeping around" the
|
||||||
|
// previously cached version of your web app until all open instances have
|
||||||
|
// been closed.
|
||||||
|
// See https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase
|
||||||
|
skipWaiting: false,
|
||||||
}),
|
}),
|
||||||
// Moment.js is an extremely popular library that bundles large locale files
|
// Moment.js is an extremely popular library that bundles large locale files
|
||||||
// by default due to how Webpack interprets its code. This is a practical
|
// by default due to how Webpack interprets its code. This is a practical
|
||||||
|
@ -339,4 +477,7 @@ module.exports = {
|
||||||
tls: 'empty',
|
tls: 'empty',
|
||||||
child_process: 'empty',
|
child_process: 'empty',
|
||||||
},
|
},
|
||||||
|
// Turn off performance processing because we utilize
|
||||||
|
// our own hints via the FileSizeReporter
|
||||||
|
performance: false,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
|
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
|
||||||
|
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
|
||||||
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
|
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
|
||||||
const ignoredFiles = require('react-dev-utils/ignoredFiles');
|
const ignoredFiles = require('react-dev-utils/ignoredFiles');
|
||||||
const config = require('./webpack.config.dev');
|
const config = require('./webpack.config.dev');
|
||||||
const paths = require('./paths');
|
const paths = require('./paths');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
||||||
const host = process.env.HOST || '0.0.0.0';
|
const host = process.env.HOST || '0.0.0.0';
|
||||||
|
@ -17,8 +19,8 @@ module.exports = function(proxy, allowedHost) {
|
||||||
// https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
|
// https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
|
||||||
// However, it made several existing use cases such as development in cloud
|
// However, it made several existing use cases such as development in cloud
|
||||||
// environment or subdomains in development significantly more complicated:
|
// environment or subdomains in development significantly more complicated:
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/2271
|
// https://github.com/facebook/create-react-app/issues/2271
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/2233
|
// https://github.com/facebook/create-react-app/issues/2233
|
||||||
// While we're investigating better solutions, for now we will take a
|
// While we're investigating better solutions, for now we will take a
|
||||||
// compromise. Since our WDS configuration only serves files in the `public`
|
// compromise. Since our WDS configuration only serves files in the `public`
|
||||||
// folder we won't consider accessing them a vulnerability. However, if you
|
// folder we won't consider accessing them a vulnerability. However, if you
|
||||||
|
@ -61,34 +63,42 @@ module.exports = function(proxy, allowedHost) {
|
||||||
// as we specified in the config. In development, we always serve from /.
|
// as we specified in the config. In development, we always serve from /.
|
||||||
publicPath: config.output.publicPath,
|
publicPath: config.output.publicPath,
|
||||||
// WebpackDevServer is noisy by default so we emit custom message instead
|
// WebpackDevServer is noisy by default so we emit custom message instead
|
||||||
// by listening to the compiler events with `compiler.plugin` calls above.
|
// by listening to the compiler events with `compiler.hooks[...].tap` calls above.
|
||||||
quiet: true,
|
quiet: true,
|
||||||
// Reportedly, this avoids CPU overload on some systems.
|
// Reportedly, this avoids CPU overload on some systems.
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/293
|
// https://github.com/facebook/create-react-app/issues/293
|
||||||
// src/node_modules is not ignored to support absolute imports
|
// src/node_modules is not ignored to support absolute imports
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/1065
|
// https://github.com/facebook/create-react-app/issues/1065
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
ignored: ignoredFiles(paths.appSrc),
|
ignored: ignoredFiles(paths.appSrc),
|
||||||
},
|
},
|
||||||
// Enable HTTPS if the HTTPS environment variable is set to 'true'
|
// Enable HTTPS if the HTTPS environment variable is set to 'true'
|
||||||
https: protocol === 'https',
|
https: protocol === 'https',
|
||||||
host: host,
|
host,
|
||||||
overlay: false,
|
overlay: false,
|
||||||
historyApiFallback: {
|
historyApiFallback: {
|
||||||
// Paths with dots should still use the history fallback.
|
// Paths with dots should still use the history fallback.
|
||||||
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
// See https://github.com/facebook/create-react-app/issues/387.
|
||||||
disableDotRule: true,
|
disableDotRule: true,
|
||||||
},
|
},
|
||||||
public: allowedHost,
|
public: allowedHost,
|
||||||
proxy,
|
proxy,
|
||||||
before(app) {
|
before(app, server) {
|
||||||
|
if (fs.existsSync(paths.proxySetup)) {
|
||||||
|
// This registers user provided middleware for proxy reasons
|
||||||
|
require(paths.proxySetup)(app);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This lets us fetch source contents from webpack for the error overlay
|
||||||
|
app.use(evalSourceMapMiddleware(server));
|
||||||
// This lets us open files from the runtime error overlay.
|
// This lets us open files from the runtime error overlay.
|
||||||
app.use(errorOverlayMiddleware());
|
app.use(errorOverlayMiddleware());
|
||||||
|
|
||||||
// This service worker file is effectively a 'no-op' that will reset any
|
// This service worker file is effectively a 'no-op' that will reset any
|
||||||
// previous service worker registered for the same host:port combination.
|
// previous service worker registered for the same host:port combination.
|
||||||
// We do this in development to avoid hitting the production cache if
|
// We do this in development to avoid hitting the production cache if
|
||||||
// it used the same host and port.
|
// it used the same host and port.
|
||||||
// https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
|
// https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
|
||||||
app.use(noopServiceWorkerMiddleware());
|
app.use(noopServiceWorkerMiddleware());
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
114
package.json
114
package.json
|
@ -4,56 +4,65 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://rewrite.michaelkohler.info/",
|
"homepage": "https://rewrite.michaelkohler.info/",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"autoprefixer": "^9.1.3",
|
"@babel/core": "7.1.0",
|
||||||
"babel-core": "^6.26.3",
|
"@babel/runtime": "7.0.0",
|
||||||
"babel-eslint": "^9.0.0",
|
"@svgr/webpack": "2.4.1",
|
||||||
"babel-jest": "^23.4.2",
|
"babel-core": "7.0.0-bridge.0",
|
||||||
"babel-loader": "^7.1.2",
|
"babel-eslint": "9.0.0",
|
||||||
"babel-polyfill": "^6.26.0",
|
"babel-jest": "23.6.0",
|
||||||
"babel-preset-react-app": "^3.1.1",
|
"babel-loader": "8.0.2",
|
||||||
|
"babel-plugin-named-asset-import": "^0.2.0",
|
||||||
|
"babel-preset-react-app": "^4.0.0",
|
||||||
|
"bfj": "6.1.1",
|
||||||
"bootstrap": "^3.3.7",
|
"bootstrap": "^3.3.7",
|
||||||
"case-sensitive-paths-webpack-plugin": "^2.1.2",
|
"case-sensitive-paths-webpack-plugin": "2.1.2",
|
||||||
"chalk": "^2.4.1",
|
"chalk": "2.4.1",
|
||||||
"css-loader": "^1.0.0",
|
"css-loader": "1.0.0",
|
||||||
"dotenv": "^6.0.0",
|
"dotenv": "6.0.0",
|
||||||
"dotenv-expand": "4.2.0",
|
"dotenv-expand": "4.2.0",
|
||||||
"eslint": "^5.5.0",
|
"eslint": "5.6.0",
|
||||||
"eslint-config-react-app": "^2.1.0",
|
"eslint-config-react-app": "^3.0.0",
|
||||||
"eslint-loader": "^2.1.0",
|
"eslint-loader": "2.1.1",
|
||||||
"eslint-plugin-flowtype": "^2.50.0",
|
"eslint-plugin-flowtype": "2.50.1",
|
||||||
"eslint-plugin-import": "^2.14.0",
|
"eslint-plugin-import": "2.14.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.1.1",
|
"eslint-plugin-jsx-a11y": "6.1.1",
|
||||||
"eslint-plugin-react": "^7.11.1",
|
"eslint-plugin-react": "7.11.1",
|
||||||
"extract-text-webpack-plugin": "3.0.2",
|
"file-loader": "2.0.0",
|
||||||
"file-loader": "^2.0.0",
|
|
||||||
"fluent": "^0.8.0",
|
"fluent": "^0.8.0",
|
||||||
"fluent-intl-polyfill": "^0.1.0",
|
"fluent-intl-polyfill": "^0.1.0",
|
||||||
"fluent-langneg": "^0.1.0",
|
"fluent-langneg": "^0.1.0",
|
||||||
"fluent-react": "^0.8.1",
|
"fluent-react": "^0.8.1",
|
||||||
"fs-extra": "^7.0.0",
|
"fs-extra": "7.0.0",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"history": "^4.7.2",
|
||||||
"jest": "^23.5.0",
|
"html-webpack-plugin": "4.0.0-alpha.2",
|
||||||
"object-assign": "4.1.1",
|
"identity-obj-proxy": "3.0.0",
|
||||||
"postcss-flexbugs-fixes": "^4.1.0",
|
"jest": "23.6.0",
|
||||||
"postcss-loader": "^3.0.0",
|
"loader-utils": "1.1.0",
|
||||||
"promise": "8.0.1",
|
"mini-css-extract-plugin": "0.4.3",
|
||||||
"raf": "3.4.0",
|
"optimize-css-assets-webpack-plugin": "5.0.1",
|
||||||
|
"postcss-flexbugs-fixes": "4.1.0",
|
||||||
|
"postcss-loader": "3.0.0",
|
||||||
|
"postcss-preset-env": "6.0.6",
|
||||||
|
"postcss-safe-parser": "4.0.1",
|
||||||
"react": "^16.4.2",
|
"react": "^16.4.2",
|
||||||
|
"react-app-polyfill": "^0.1.0",
|
||||||
"react-bootstrap": "^0.32.3",
|
"react-bootstrap": "^0.32.3",
|
||||||
"react-dev-utils": "^5.0.2",
|
"react-dev-utils": "^6.0.0",
|
||||||
"react-dom": "^16.4.2",
|
"react-dom": "^16.5.2",
|
||||||
"react-redux": "^5.0.7",
|
"react-redux": "^5.0.7",
|
||||||
"react-router-dom": "^4.3.1",
|
"react-router-dom": "^4.3.1",
|
||||||
"redux": "^4.0.0",
|
"redux": "^4.0.0",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
"resolve": "^1.8.1",
|
"resolve": "1.8.1",
|
||||||
"style-loader": "^0.23.0",
|
"sass-loader": "7.1.0",
|
||||||
"sw-precache-webpack-plugin": "^0.11.5",
|
"style-loader": "0.23.0",
|
||||||
"url-loader": "^1.1.1",
|
"sw-precache-webpack-plugin": "0.11.5",
|
||||||
"webpack": "^3.8.1",
|
"terser-webpack-plugin": "1.1.0",
|
||||||
"webpack-dev-server": "2.9.4",
|
"thread-loader": "1.2.0",
|
||||||
"webpack-manifest-plugin": "1.3.2",
|
"url-loader": "1.1.1",
|
||||||
"whatwg-fetch": "^2.0.4"
|
"webpack": "4.19.1",
|
||||||
|
"webpack-dev-server": "3.1.9",
|
||||||
|
"webpack-manifest-plugin": "2.0.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node scripts/start.js",
|
"start": "node scripts/start.js",
|
||||||
|
@ -62,29 +71,37 @@
|
||||||
"predeploy": "npm run build && cp github_404.html build/404.html",
|
"predeploy": "npm run build && cp github_404.html build/404.html",
|
||||||
"deploy": "gh-pages -d build"
|
"deploy": "gh-pages -d build"
|
||||||
},
|
},
|
||||||
|
"browserslist": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not ie <= 11",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
"jest": {
|
"jest": {
|
||||||
"collectCoverageFrom": [
|
"collectCoverageFrom": [
|
||||||
"src/**/*.{js,jsx,mjs}"
|
"src/**/*.{js,jsx}"
|
||||||
],
|
],
|
||||||
"setupFiles": [
|
"setupFiles": [
|
||||||
"<rootDir>/config/polyfills.js"
|
"react-app-polyfill/jsdom"
|
||||||
],
|
],
|
||||||
"testMatch": [
|
"testMatch": [
|
||||||
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
|
"<rootDir>/src/**/__tests__/**/*.{js,jsx}",
|
||||||
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
|
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx}"
|
||||||
],
|
],
|
||||||
"testEnvironment": "node",
|
"testEnvironment": "jsdom",
|
||||||
"testURL": "http://localhost",
|
"testURL": "http://localhost",
|
||||||
"transform": {
|
"transform": {
|
||||||
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
|
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
|
||||||
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
|
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
|
||||||
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
|
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
|
||||||
},
|
},
|
||||||
"transformIgnorePatterns": [
|
"transformIgnorePatterns": [
|
||||||
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
|
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$",
|
||||||
|
"^.+\\.module\\.(css|sass|scss)$"
|
||||||
],
|
],
|
||||||
"moduleNameMapper": {
|
"moduleNameMapper": {
|
||||||
"^react-native$": "react-native-web"
|
"^react-native$": "react-native-web",
|
||||||
|
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
|
||||||
},
|
},
|
||||||
"moduleFileExtensions": [
|
"moduleFileExtensions": [
|
||||||
"web.js",
|
"web.js",
|
||||||
|
@ -92,8 +109,7 @@
|
||||||
"json",
|
"json",
|
||||||
"web.jsx",
|
"web.jsx",
|
||||||
"jsx",
|
"jsx",
|
||||||
"node",
|
"node"
|
||||||
"mjs"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
|
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
|
|
||||||
import 'babel-polyfill';
|
|
||||||
import 'fluent-intl-polyfill/compat';
|
import 'fluent-intl-polyfill/compat';
|
||||||
|
|
||||||
import 'bootstrap/dist/css/bootstrap.css';
|
import 'bootstrap/dist/css/bootstrap.css';
|
||||||
|
|
Загрузка…
Ссылка в новой задаче