Browse Source

Add rollup build

zhixin 6 years ago
parent
commit
bae84d7ed3
3 changed files with 28 additions and 2 deletions
  1. 3 1
      package.json
  2. 24 1
      rollup.config.js
  3. 1 0
      src/vue/BootstrapTable.vue

+ 3 - 1
package.json

@@ -22,7 +22,9 @@
     "rollup-plugin-inject": "^2.2.0",
     "rollup-plugin-inject": "^2.2.0",
     "rollup-plugin-multi-entry": "^2.1.0",
     "rollup-plugin-multi-entry": "^2.1.0",
     "rollup-plugin-node-resolve": "^4.0.1",
     "rollup-plugin-node-resolve": "^4.0.1",
-    "sass": "^1.16.1"
+    "rollup-plugin-vue": "^5.0.0",
+    "sass": "^1.16.1",
+    "vue-template-compiler": "^2.6.10"
   },
   },
   "scripts": {
   "scripts": {
     "lint": "eslint src",
     "lint": "eslint src",

+ 24 - 1
rollup.config.js

@@ -5,9 +5,15 @@ import commonjs from 'rollup-plugin-commonjs'
 import minify from 'rollup-plugin-babel-minify'
 import minify from 'rollup-plugin-babel-minify'
 import inject from 'rollup-plugin-inject'
 import inject from 'rollup-plugin-inject'
 import multiEntry from 'rollup-plugin-multi-entry'
 import multiEntry from 'rollup-plugin-multi-entry'
+import vue from 'rollup-plugin-vue'
 
 
 const files = glob.sync('src/**/*.js', {
 const files = glob.sync('src/**/*.js', {
-  ignore: ['src/constants/**', 'src/utils/**', 'src/virtual-scroll/**']
+  ignore: [
+    'src/constants/**',
+    'src/utils/**',
+    'src/virtual-scroll/**',
+    'src/vue/**'
+  ]
 })
 })
 const external = ['jquery']
 const external = ['jquery']
 const globals = {
 const globals = {
@@ -70,4 +76,21 @@ config.push({
   ]
   ]
 })
 })
 
 
+out = 'dist/vue.js'
+if (process.env.NODE_ENV === 'production') {
+  out = out.replace(/.js$/, '.min.js')
+}
+config.push({
+  input: 'src/vue/BootstrapTable.vue',
+  output: {
+    name: 'BootstrapTable',
+    file: out,
+    format: 'esm'
+  },
+  plugins: [
+    vue(),
+    ...plugins
+  ]
+})
+
 export default config
 export default config

+ 1 - 0
src/vue/BootstrapTable.vue

@@ -9,6 +9,7 @@ const deepCopy = arg => {
 }
 }
 
 
 export default {
 export default {
+  name: 'BootstrapTable',
   props: {
   props: {
     options: {
     options: {
       type: Object,
       type: Object,