vue.config.js 982 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. let isLib = process.env.TARGET === 'lib'
  2. module.exports = {
  3. css: {
  4. extract: !isLib
  5. },
  6. chainWebpack: config => {
  7. if (isLib) {
  8. // https://github.com/vuejs/vue-cli/issues/2646
  9. config.merge({
  10. externals: {
  11. vue: {
  12. commonjs: 'vue',
  13. commonjs2: 'vue',
  14. root: 'Vue',
  15. },
  16. three: {
  17. commonjs: 'three',
  18. commonjs2: 'three',
  19. root: 'THREE',
  20. },
  21. 'dat.gui': {
  22. commonjs: 'dat.gui',
  23. commonjs2: 'dat.gui',
  24. // https://github.com/dataarts/dat.gui/blob/1b18f7227e56c8b5071337732342101501b9fa95/rollup.config.js#L30
  25. root: 'dat',
  26. },
  27. oimo: {
  28. commonjs: 'oimo',
  29. commonjs2: 'oimo',
  30. // https://github.com/lo-th/Oimo.js/blob/0ce1c3d8ff3f857d9180035076a70d8d6976a3e6/rollup.config.js#L7
  31. root: 'OIMO',
  32. },
  33. }
  34. })
  35. }
  36. },
  37. }