Permalink
Browse files

fix(build): use esm bundle. resolves #1296.

  • Loading branch information...
pi0 committed Nov 7, 2017
1 parent e766e75 commit 06d40a54b61f6bdd118ab2fd4c87be072e860034
Showing with 51 additions and 7 deletions.
  1. +1 −0 build/build
  2. +48 −0 build/rollup.config.esm.js
  3. +0 −5 build/rollup.config.js
  4. +2 −2 package.json
@@ -9,6 +9,7 @@ BABEL_ENV=es babel -d es -D --ignore '*.spec.js,*.json,fixtures' src/
# Rollup (dist/)
rollup -c build/rollup.config.js
rollup -c build/rollup.config.esm.js
# Uglify rollup build
uglify=`pwd`/node_modules/.bin/uglifyjs
@@ -0,0 +1,48 @@
const fs = require("fs");
const path = require("path");
const vue = require("rollup-plugin-vue");
const babel = require("rollup-plugin-babel");
const resolve = require("rollup-plugin-node-resolve");
const commonjs = require("rollup-plugin-commonjs");
const CleanCSS = require("clean-css");
const { camelCase } = require("lodash");
const { name, dependencies } = require("../package.json");
const base = path.resolve(__dirname, "..");
const src = path.resolve(base, "src");
const dist = path.resolve(base, "dist");
// Ensure dist directory exists
if (!fs.existsSync(dist)) {
fs.mkdirSync(dist);
}
module.exports = {
input: path.resolve(src, "index.js"),
external: Object.keys(dependencies),
name,
plugins: [
vue({
cssModules: {
generateScopedName: "[name]__[local]"
},
css(style) {
fs.writeFileSync(path.resolve(dist, `${name}.css`), new CleanCSS().minify(style).styles);
}
}),
resolve({ external: ["vue"] }),
commonjs(),
babel({
plugins: [
'external-helpers'
]
})
],
output: [
{
format: "es",
file: path.resolve(dist, name + ".esm.js"),
sourcemap: true
}
]
};
@@ -53,11 +53,6 @@ module.exports = {
file: path.resolve(dist, name + ".common.js"),
sourcemap: true
},
{
format: "es",
file: path.resolve(dist, name + ".esm.js"),
sourcemap: true
},
{
format: "umd",
modulename: camelCase(name),
@@ -4,8 +4,8 @@
"description": "Quickly integrate Bootstrap 4 components with Vue.js",
"main": "dist/bootstrap-vue.common.js",
"web": "dist/bootstrap-vue.js",
"module": "es/index.js",
"jsnext:main": "es/index.js",
"module": "dist/bootstrap-vue.esm.js",
"jsnext:main": "dist/bootstrap-vue.esm.js",
"style": "dist/bootstrap-vue.css",
"license": "MIT",
"homepage": "https://bootstrap-vue.github.io",

0 comments on commit 06d40a5

Please sign in to comment.