File tree Expand file tree Collapse file tree 3 files changed +58
-2
lines changed
Expand file tree Collapse file tree 3 files changed +58
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ node_modules
1414/styles /** /* .css
1515/coverage
1616/widget
17+ /schema
1718
1819* .tgz
1920.env
Original file line number Diff line number Diff line change 2424 "import" : " ./server/index.js"
2525 },
2626 "./styles/*" : " ./styles/*" ,
27- "./widget/*" : " ./widget/*"
27+ "./widget/*" : " ./widget/*" ,
28+ "./schema/*" : " ./schema/*"
2829 },
2930 "main" : " ./build/cjs/index.js" ,
3031 "module" : " ./build/esm/index.js" ,
7273 "build:client" : " gulp" ,
7374 "build:server" : " rimraf server && tsc -p tsconfig.server.json && move-file server/server.js server/index.js && move-file server/server.d.ts server/index.d.ts" ,
7475 "build:widget" : " webpack --config widget.webpack.js" ,
75- "build" : " run-p build:client build:server build:widget" ,
76+ "build:schema" : " webpack --config schema.webpack.js" ,
77+ "build" : " run-p build:client build:server build:widget build:schema" ,
7678 "prepublishOnly" : " npm run lint && npm run build" ,
7779 "prepare" : " husky install" ,
7880 "test" : " jest" ,
Original file line number Diff line number Diff line change 1+ /* eslint-env node */
2+ // Schema generation has client dependencies, to run it on the node we bundle it.
3+ const path = require ( 'path' ) ;
4+
5+ const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
6+
7+ const SRC_PATH = path . resolve ( 'src' ) ;
8+ const SCHEMA_SRC_PATH = path . resolve ( SRC_PATH , 'schema' ) ;
9+ const SCHEMA_RESULT_PATH = path . resolve ( __dirname , 'schema' ) ;
10+ const SCHEMA_BUNDLE_FILENAME = 'index.js' ;
11+
12+ module . exports = {
13+ entry : path . resolve ( SCHEMA_SRC_PATH , 'index.ts' ) ,
14+ output : {
15+ path : SCHEMA_RESULT_PATH ,
16+ filename : SCHEMA_BUNDLE_FILENAME ,
17+ library : 'library' ,
18+ libraryTarget : 'umd' ,
19+ } ,
20+ mode : 'production' ,
21+ target : 'node' ,
22+ module : {
23+ rules : [
24+ {
25+ test : / \. [ j t ] s x ? $ / ,
26+ exclude : [ / n o d e _ m o d u l e s / ] ,
27+ use : {
28+ loader : 'babel-loader' ,
29+ } ,
30+ } ,
31+ {
32+ test : / \. c s s $ / ,
33+ use : 'null-loader' ,
34+ } ,
35+ ] ,
36+ } ,
37+ resolve : {
38+ extensions : [ '.tsx' , '.ts' , '.js' ] ,
39+ } ,
40+ optimization : {
41+ minimize : true ,
42+ minimizer : [
43+ new TerserPlugin ( {
44+ extractComments : false ,
45+ terserOptions : {
46+ format : {
47+ comments : false ,
48+ } ,
49+ } ,
50+ } ) ,
51+ ] ,
52+ } ,
53+ } ;
You can’t perform that action at this time.
0 commit comments