-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.production.js
43 lines (41 loc) · 980 Bytes
/
webpack.production.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const path = require( 'path' ),
fs = require( 'fs' ),
appDirectory = fs.realpathSync( process.cwd() ),
nodeExternals = require( 'webpack-node-externals' ),
resolveAppPath = ( relativePath ) =>
path.resolve( appDirectory, relativePath );
// Required for babel-preset-react-app
process.env.NODE_ENV = 'production';
module.exports = {
mode: 'production',
entry: resolveAppPath( 'src/index.js' ),
output: {
path: resolveAppPath( 'dist' ),
filename: 'index.js',
library: {
name: 'anywhere-editor',
type: 'umd',
},
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: '/node_modules/',
include: [ resolveAppPath( 'src' ) ],
loader: 'babel-loader',
options: {
presets: [
// Preset includes JSX, TypeScript, and some ESnext features
require.resolve( 'babel-preset-react-app' ),
],
},
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ],
},
],
},
externals: [ nodeExternals() ],
};