diff --git a/package.json b/package.json index 2292bb67..7c27b0ad 100644 --- a/package.json +++ b/package.json @@ -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": "", diff --git a/webpack.config.ts b/webpack.config.ts index ba30b726..adf230bf 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -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.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'; + + 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], + }); + } } else { config.plugins!.push( new HtmlWebpackPlugin({