1- 'use strict' ;
21
3- const autoprefixer = require ( 'autoprefixer' ) ;
4- const path = require ( 'path' ) ;
5- const webpack = require ( 'webpack' ) ;
6- const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
7- const CaseSensitivePathsPlugin = require ( 'case-sensitive-paths-webpack-plugin' ) ;
8- const InterpolateHtmlPlugin = require ( 'react-dev-utils/InterpolateHtmlPlugin' ) ;
9- const WatchMissingNodeModulesPlugin = require ( 'react-dev-utils/WatchMissingNodeModulesPlugin' ) ;
10- const eslintFormatter = require ( 'react-dev-utils/eslintFormatter' ) ;
11- const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
12- const getClientEnvironment = require ( './env' ) ;
13- const paths = require ( './paths' ) ;
2+
3+ const autoprefixer = require ( 'autoprefixer' )
4+ const path = require ( 'path' )
5+ const webpack = require ( 'webpack' )
6+ const HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
7+ const CaseSensitivePathsPlugin = require ( 'case-sensitive-paths-webpack-plugin' )
8+ const InterpolateHtmlPlugin = require ( 'react-dev-utils/InterpolateHtmlPlugin' )
9+ const WatchMissingNodeModulesPlugin = require ( 'react-dev-utils/WatchMissingNodeModulesPlugin' )
10+ const eslintFormatter = require ( 'react-dev-utils/eslintFormatter' )
11+ const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' )
12+ const getClientEnvironment = require ( './env' )
13+ const paths = require ( './paths' )
1414
1515// Webpack uses `publicPath` to determine where the app is being served from.
1616// In development, we always serve from the root. This makes config easier.
17- const publicPath = '/' ;
17+ const publicPath = '/'
1818// `publicUrl` is just like `publicPath`, but we will provide it to our app
1919// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
2020// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
21- const publicUrl = '' ;
21+ const publicUrl = ''
2222// Get environment variables to inject into our app.
23- const env = getClientEnvironment ( publicUrl ) ;
23+ const env = getClientEnvironment ( publicUrl )
2424
2525// This is the development configuration.
2626// It is focused on developer experience and fast rebuilds.
@@ -59,10 +59,13 @@ module.exports = {
5959 // served by WebpackDevServer in development. This is the JS bundle
6060 // containing code from all our entry points, and the Webpack runtime.
6161 filename : 'static/js/bundle.js' ,
62+ library : require ( '../package.json' ) . name ,
63+ libraryTarget : 'umd' ,
64+ umdNamedDefine : true ,
6265 // There are also additional JS chunk files if you use code splitting.
6366 chunkFilename : 'static/js/[name].chunk.js' ,
6467 // This is the URL that app is served from. We use "/" in development.
65- publicPath : publicPath ,
68+ publicPath,
6669 // Point sourcemap entries to original disk location (format as URL on Windows)
6770 devtoolModuleFilenameTemplate : info =>
6871 path . resolve ( info . absoluteResourcePath ) . replace ( / \\ / g, '/' ) ,
@@ -84,7 +87,7 @@ module.exports = {
8487 // for React Native Web.
8588 extensions : [ '.web.js' , '.mjs' , '.js' , '.json' , '.web.jsx' , '.jsx' ] ,
8689 alias : {
87-
90+
8891 // Support React Native Web
8992 // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
9093 'react-native' : 'react-native-web' ,
@@ -115,7 +118,7 @@ module.exports = {
115118 options : {
116119 formatter : eslintFormatter ,
117120 eslintPath : require . resolve ( 'eslint' ) ,
118-
121+
119122 } ,
120123 loader : require . resolve ( 'eslint-loader' ) ,
121124 } ,
@@ -144,7 +147,7 @@ module.exports = {
144147 include : paths . appSrc ,
145148 loader : require . resolve ( 'babel-loader' ) ,
146149 options : {
147-
150+
148151 // This is a feature of `babel-loader` for webpack (not Babel itself).
149152 // It enables caching results in ./node_modules/.cache/babel-loader/
150153 // directory for faster rebuilds.
@@ -259,4 +262,4 @@ module.exports = {
259262 performance : {
260263 hints : false ,
261264 } ,
262- } ;
265+ }
0 commit comments