Selaa lähdekoodia

build: use umd instead of window

Micooz 7 vuotta sitten
vanhempi
commit
2d0f91eef1
3 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
  1. 1 1
      src/index.js
  2. 3 0
      webpack/dev.config.js
  3. 3 0
      webpack/prod.config.js

+ 1 - 1
src/index.js

@@ -1 +1 @@
-window.DPlayer = require('./DPlayer');
+module.exports = require('./DPlayer');

+ 3 - 0
webpack/dev.config.js

@@ -12,6 +12,9 @@ module.exports = {
   output: {
     path: path.resolve(__dirname, '..', 'dist'),
     filename: '[name].js',
+    library: '[name]',
+    libraryTarget: 'umd',
+    umdNamedDefine: true,
     publicPath: '/'
   },
 

+ 3 - 0
webpack/prod.config.js

@@ -15,6 +15,9 @@ module.exports = {
   output: {
     path: path.resolve(__dirname, '..', 'dist'),
     filename: '[name].min.js',
+    library: '[name]',
+    libraryTarget: 'umd',
+    umdNamedDefine: true,
     publicPath: '/'
   },