1
- 'use strict' ;
2
1
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' )
14
14
15
15
// Webpack uses `publicPath` to determine where the app is being served from.
16
16
// In development, we always serve from the root. This makes config easier.
17
- const publicPath = '/' ;
17
+ const publicPath = '/'
18
18
// `publicUrl` is just like `publicPath`, but we will provide it to our app
19
19
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
20
20
// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
21
- const publicUrl = '' ;
21
+ const publicUrl = ''
22
22
// Get environment variables to inject into our app.
23
- const env = getClientEnvironment ( publicUrl ) ;
23
+ const env = getClientEnvironment ( publicUrl )
24
24
25
25
// This is the development configuration.
26
26
// It is focused on developer experience and fast rebuilds.
@@ -59,10 +59,13 @@ module.exports = {
59
59
// served by WebpackDevServer in development. This is the JS bundle
60
60
// containing code from all our entry points, and the Webpack runtime.
61
61
filename : 'static/js/bundle.js' ,
62
+ library : require ( '../package.json' ) . name ,
63
+ libraryTarget : 'umd' ,
64
+ umdNamedDefine : true ,
62
65
// There are also additional JS chunk files if you use code splitting.
63
66
chunkFilename : 'static/js/[name].chunk.js' ,
64
67
// This is the URL that app is served from. We use "/" in development.
65
- publicPath : publicPath ,
68
+ publicPath,
66
69
// Point sourcemap entries to original disk location (format as URL on Windows)
67
70
devtoolModuleFilenameTemplate : info =>
68
71
path . resolve ( info . absoluteResourcePath ) . replace ( / \\ / g, '/' ) ,
@@ -84,7 +87,7 @@ module.exports = {
84
87
// for React Native Web.
85
88
extensions : [ '.web.js' , '.mjs' , '.js' , '.json' , '.web.jsx' , '.jsx' ] ,
86
89
alias : {
87
-
90
+
88
91
// Support React Native Web
89
92
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
90
93
'react-native' : 'react-native-web' ,
@@ -115,7 +118,7 @@ module.exports = {
115
118
options : {
116
119
formatter : eslintFormatter ,
117
120
eslintPath : require . resolve ( 'eslint' ) ,
118
-
121
+
119
122
} ,
120
123
loader : require . resolve ( 'eslint-loader' ) ,
121
124
} ,
@@ -144,7 +147,7 @@ module.exports = {
144
147
include : paths . appSrc ,
145
148
loader : require . resolve ( 'babel-loader' ) ,
146
149
options : {
147
-
150
+
148
151
// This is a feature of `babel-loader` for webpack (not Babel itself).
149
152
// It enables caching results in ./node_modules/.cache/babel-loader/
150
153
// directory for faster rebuilds.
@@ -259,4 +262,4 @@ module.exports = {
259
262
performance : {
260
263
hints : false ,
261
264
} ,
262
- } ;
265
+ }
0 commit comments