mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-10 19:06:34 +03:00
Fix bundles
This commit is contained in:
parent
f7374caf3c
commit
bab7ce9f84
|
@ -11,7 +11,7 @@
|
|||
"dev": "webpack-dashboard -- webpack-dev-server --hot",
|
||||
"test": "npm run unit && npm run e2e",
|
||||
"unit": "jest",
|
||||
"e2e": "npm run e2e:tsc && cypress run",
|
||||
"e2e": "npm run e2e:clean && npm run e2e:tsc && cypress run",
|
||||
"e2e:tsc": "tsc -p tsconfig.e2e.json",
|
||||
"e2e:clean": "rimraf e2e/.build",
|
||||
"cy:open": "cypress open",
|
||||
|
@ -19,7 +19,7 @@
|
|||
"bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod",
|
||||
"bundle:lib": "webpack -p --env.lib --env.prod",
|
||||
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
|
||||
"stats": "webpack -p --env.prod --json --profile > stats.json",
|
||||
"stats": "webpack -p --env.lib --env.standalone --env.prod --json --profile > stats.json",
|
||||
"prettier": "prettier --write \"src/**/*.{ts,tsx}\""
|
||||
},
|
||||
"author": "",
|
||||
|
|
|
@ -7,7 +7,7 @@ export default env => {
|
|||
|
||||
let entry;
|
||||
|
||||
if (env.bundle) {
|
||||
if (env.lib) {
|
||||
entry = env.standalone ? ['./src/polyfills.ts', './src/standalone.tsx'] : './src/index.ts';
|
||||
} else {
|
||||
// playground or performance test
|
||||
|
@ -25,7 +25,7 @@ export default env => {
|
|||
entry: entry,
|
||||
output: {
|
||||
filename: env.standalone ? 'redoc.standalone.js' : 'redoc.lib.js',
|
||||
path: __dirname + (env.bundle ? '/bundles' : 'lib'),
|
||||
path: __dirname + (env.lib ? '/bundles' : 'lib'),
|
||||
},
|
||||
|
||||
devServer: {
|
||||
|
@ -101,13 +101,15 @@ export default env => {
|
|||
}
|
||||
|
||||
if (env.lib) {
|
||||
config.output!.library = 'Redoc';
|
||||
config.output!.libraryTarget = 'umd';
|
||||
|
||||
if (!env.standalone) {
|
||||
config.externals = nodeExternals({
|
||||
// bundle in moudules that need transpiling + non-js (e.g. css)
|
||||
whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i],
|
||||
});
|
||||
|
||||
config.output!.library = 'Redoc';
|
||||
config.output!.libraryTarget = 'umd';
|
||||
}
|
||||
} else {
|
||||
config.plugins!.push(
|
||||
new HtmlWebpackPlugin({
|
||||
|
|
Loading…
Reference in New Issue
Block a user