-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f03f055
Showing
11 changed files
with
27,696 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
current node | ||
last 2 versions and > 2% | ||
ie > 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const devPresets = ['@vue/babel-preset-app']; | ||
const buildPresets = [ | ||
[ | ||
'@babel/preset-env', | ||
// Config for @babel/preset-env | ||
{ | ||
// Example: Always transpile optional chaining/nullish coalescing | ||
// include: [ | ||
// /(optional-chaining|nullish-coalescing)/ | ||
// ], | ||
}, | ||
], | ||
]; | ||
module.exports = { | ||
presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
// rollup.config.js | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import vue from 'rollup-plugin-vue'; | ||
import alias from '@rollup/plugin-alias'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import replace from '@rollup/plugin-replace'; | ||
import babel from '@rollup/plugin-babel'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import minimist from 'minimist'; | ||
|
||
// Get browserslist config and remove ie from es build targets | ||
const esbrowserslist = fs.readFileSync('./.browserslistrc') | ||
.toString() | ||
.split('\n') | ||
.filter((entry) => entry && entry.substring(0, 2) !== 'ie'); | ||
|
||
// Extract babel preset-env config, to combine with esbrowserslist | ||
const babelPresetEnvConfig = require('../babel.config') | ||
.presets.filter((entry) => entry[0] === '@babel/preset-env')[0][1]; | ||
|
||
const argv = minimist(process.argv.slice(2)); | ||
|
||
const projectRoot = path.resolve(__dirname, '..'); | ||
|
||
const baseConfig = { | ||
input: 'src/entry.js', | ||
plugins: { | ||
preVue: [ | ||
alias({ | ||
entries: [ | ||
{ | ||
find: '@', | ||
replacement: `${path.resolve(projectRoot, 'src')}`, | ||
}, | ||
], | ||
}), | ||
], | ||
replace: { | ||
'process.env.NODE_ENV': JSON.stringify('production'), | ||
}, | ||
vue: { | ||
css: true, | ||
template: { | ||
isProduction: true, | ||
}, | ||
}, | ||
postVue: [ | ||
resolve({ | ||
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'], | ||
}), | ||
commonjs(), | ||
], | ||
babel: { | ||
exclude: 'node_modules/**', | ||
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'], | ||
babelHelpers: 'bundled', | ||
}, | ||
}, | ||
}; | ||
|
||
// ESM/UMD/IIFE shared settings: externals | ||
// Refer to https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency | ||
const external = [ | ||
// list external dependencies, exactly the way it is written in the import statement. | ||
// eg. 'jquery' | ||
'vue', | ||
]; | ||
|
||
// UMD/IIFE shared settings: output.globals | ||
// Refer to https://rollupjs.org/guide/en#output-globals for details | ||
const globals = { | ||
// Provide global variable names to replace your external imports | ||
// eg. jquery: '$' | ||
vue: 'Vue', | ||
}; | ||
|
||
// Customize configs for individual targets | ||
const buildFormats = []; | ||
if (!argv.format || argv.format === 'es') { | ||
const esConfig = { | ||
...baseConfig, | ||
input: 'src/entry.esm.js', | ||
external, | ||
output: { | ||
file: 'dist/bootstrap-vue-timeline.esm.js', | ||
format: 'esm', | ||
exports: 'named', | ||
}, | ||
plugins: [ | ||
replace(baseConfig.plugins.replace), | ||
...baseConfig.plugins.preVue, | ||
vue(baseConfig.plugins.vue), | ||
...baseConfig.plugins.postVue, | ||
babel({ | ||
...baseConfig.plugins.babel, | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
...babelPresetEnvConfig, | ||
targets: esbrowserslist, | ||
}, | ||
], | ||
], | ||
}), | ||
], | ||
}; | ||
buildFormats.push(esConfig); | ||
} | ||
|
||
if (!argv.format || argv.format === 'cjs') { | ||
const umdConfig = { | ||
...baseConfig, | ||
external, | ||
output: { | ||
compact: true, | ||
file: 'dist/bootstrap-vue-timeline.ssr.js', | ||
format: 'cjs', | ||
name: 'BootstrapVueTimeline', | ||
exports: 'auto', | ||
globals, | ||
}, | ||
plugins: [ | ||
replace(baseConfig.plugins.replace), | ||
...baseConfig.plugins.preVue, | ||
vue({ | ||
...baseConfig.plugins.vue, | ||
template: { | ||
...baseConfig.plugins.vue.template, | ||
optimizeSSR: true, | ||
}, | ||
}), | ||
...baseConfig.plugins.postVue, | ||
babel(baseConfig.plugins.babel), | ||
], | ||
}; | ||
buildFormats.push(umdConfig); | ||
} | ||
|
||
if (!argv.format || argv.format === 'iife') { | ||
const unpkgConfig = { | ||
...baseConfig, | ||
external, | ||
output: { | ||
compact: true, | ||
file: 'dist/bootstrap-vue-timeline.min.js', | ||
format: 'iife', | ||
name: 'BootstrapVueTimeline', | ||
exports: 'auto', | ||
globals, | ||
}, | ||
plugins: [ | ||
replace(baseConfig.plugins.replace), | ||
...baseConfig.plugins.preVue, | ||
vue(baseConfig.plugins.vue), | ||
...baseConfig.plugins.postVue, | ||
babel(baseConfig.plugins.babel), | ||
terser({ | ||
output: { | ||
ecma: 5, | ||
}, | ||
}), | ||
], | ||
}; | ||
buildFormats.push(unpkgConfig); | ||
} | ||
|
||
// Export config | ||
export default buildFormats; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Vue from 'vue'; | ||
import Dev from './serve.vue'; | ||
|
||
Vue.config.productionTip = false; | ||
|
||
new Vue({ | ||
render: (h) => h(Dev), | ||
}).$mount('#app'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script> | ||
import Vue from 'vue'; | ||
import BootstrapVueTimeline from '@/bootstrap-vue-timeline.vue'; | ||
export default Vue.extend({ | ||
name: 'ServeDev', | ||
components: { | ||
BootstrapVueTimeline | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div id="app"> | ||
<bootstrap-vue-timeline /> | ||
</div> | ||
</template> |
Oops, something went wrong.