-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathesbuild.config.js
More file actions
36 lines (33 loc) · 803 Bytes
/
esbuild.config.js
File metadata and controls
36 lines (33 loc) · 803 Bytes
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
import esbuild from 'esbuild';
// Get the page name from the command line arguments
let pageName = process.argv[2];
let dirName = `${pageName}/`;
if (!pageName) {
console.log('Default is index[.js]');
pageName = 'index';
dirName = '';
}
esbuild.build({
sourcemap: true,
logLevel: 'info',
platform: 'browser',
entryPoints: [`src/${pageName}.jsx`],
bundle: true,
minify: false,
outfile: `dist/${dirName}esb-bundle.js`,
write: true,
loader: {
'.js': 'jsx',
'.svg': 'file',
'.jpg': 'file',
'.jpeg': 'file',
'.png': 'file',
},
jsx: 'automatic',
define: { 'process.env.NODE_ENV': '"production"' },
jsxFactory: 'React.createElement',
jsxFragment: 'React.Fragment',
inject: ['./react-shim.js'], // 자동 주입 파일 추가
treeShaking: true,
})
.catch(() => process.exit(1));