25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

58 lines
1.3 KiB

  1. const path = require("path")
  2. const fs = require("fs")
  3. const nodeModules = fs.readdirSync("node_modules").filter(function(x) { return x !== ".bin" })
  4. const styleRules = require("./webpack.dist-style.config.js")
  5. let rules = [
  6. { test: /\.(worker\.js)(\?.*)?$/,
  7. use: [
  8. {
  9. loader: "worker-loader",
  10. options: {
  11. inline: true,
  12. name: "[name].js"
  13. }
  14. },
  15. { loader: "babel-loader" }
  16. ]
  17. }
  18. ]
  19. rules = rules.concat(styleRules)
  20. module.exports = require("./make-webpack-config.js")(rules, {
  21. _special: {
  22. separateStylesheets: true,
  23. minimize: true,
  24. sourcemaps: true,
  25. },
  26. entry: {
  27. "swagger-ui": [
  28. "./src/style/main.scss",
  29. "./src/polyfills",
  30. "./src/core/index.js"
  31. ]
  32. },
  33. externals: function(context, request, cb) {
  34. // webpack injects some stuff into the resulting file,
  35. // these libs need to be pulled in to keep that working.
  36. var exceptionsForWebpack = ["ieee754", "base64-js"]
  37. if(nodeModules.indexOf(request) !== -1 || exceptionsForWebpack.indexOf(request) !== -1) {
  38. cb(null, "commonjs " + request)
  39. return
  40. }
  41. cb()
  42. },
  43. output: {
  44. path: path.join(__dirname, "dist"),
  45. publicPath: "/dist",
  46. library: "SwaggerUICore",
  47. libraryTarget: "umd",
  48. filename: "[name].js",
  49. chunkFilename: "js/[name].js",
  50. },
  51. })