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