-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add server schema build & export (#1072)
* feat: add server schema build & export * chore: add comment why bundle needed
- Loading branch information
1 parent
eb86b60
commit d7e1b26
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ node_modules | |
/styles/**/*.css | ||
/coverage | ||
/widget | ||
/schema | ||
|
||
*.tgz | ||
.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-env node */ | ||
// Schema generation has client dependencies, to run it on the node we bundle it. | ||
const path = require('path'); | ||
|
||
const TerserPlugin = require('terser-webpack-plugin'); | ||
|
||
const SRC_PATH = path.resolve('src'); | ||
const SCHEMA_SRC_PATH = path.resolve(SRC_PATH, 'schema'); | ||
const SCHEMA_RESULT_PATH = path.resolve(__dirname, 'schema'); | ||
const SCHEMA_BUNDLE_FILENAME = 'index.js'; | ||
|
||
module.exports = { | ||
entry: path.resolve(SCHEMA_SRC_PATH, 'index.ts'), | ||
output: { | ||
path: SCHEMA_RESULT_PATH, | ||
filename: SCHEMA_BUNDLE_FILENAME, | ||
library: 'library', | ||
libraryTarget: 'umd', | ||
}, | ||
mode: 'production', | ||
target: 'node', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.[jt]sx?$/, | ||
exclude: [/node_modules/], | ||
use: { | ||
loader: 'babel-loader', | ||
}, | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: 'null-loader', | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.tsx', '.ts', '.js'], | ||
}, | ||
optimization: { | ||
minimize: true, | ||
minimizer: [ | ||
new TerserPlugin({ | ||
extractComments: false, | ||
terserOptions: { | ||
format: { | ||
comments: false, | ||
}, | ||
}, | ||
}), | ||
], | ||
}, | ||
}; |