separate iife generation and inclusion of babel-polyfill from our pure ES2015 entry point

This commit is contained in:
Kevin Ross 2016-05-05 08:44:55 -05:00
parent dbbd0fb8aa
commit 6873f3097a
5 changed files with 40 additions and 34 deletions

View File

@ -3,7 +3,7 @@ import Clipboard from 'clipboard'
import anchors from 'anchor-js'
// import all the bmd code
import '../../../../js/index' // eslint-disable-line no-unused-vars
import '../../../../js/index-iife' // eslint-disable-line no-unused-vars
class Application {

View File

@ -34,6 +34,7 @@ let namedExports = {}
const rollupConfig = {
options: {
moduleName: 'BMD',
external: [
'anchor-js',
'clipboard'
@ -81,14 +82,15 @@ const js = new Aggregate(gulp, 'js',
parallel(gulp,
new RollupUmd(gulp, preset, rollupConfig, {
options: {
dest: 'bootstrap-material-design.umd.js',
moduleName: 'bootstrapMaterialDesign'
dest: 'bootstrap-material-design.umd.js'
}
}),
new RollupIife(gulp, preset, rollupConfig, {
source: {
glob: 'index-iife.js'
},
options: {
dest: 'bootstrap-material-design.iife.js',
moduleName: 'bootstrapMaterialDesign'
dest: 'bootstrap-material-design.iife.js'
}
})
),

5
js/index-iife.js Normal file
View File

@ -0,0 +1,5 @@
/*
* This is the iife compilation entry point - only used for the build.
*/
import 'babel-polyfill/dist/polyfill'
import './index'

View File

@ -1,31 +1,29 @@
/*
* This is the main entry point for your package.
* This is the main entry point.
*
* You can import other modules here, including external packages. When
* bundling using rollup you can mark those modules as external and have them
* excluded or, if they have a jsnext:main entry in their package.json (like
* this package does), let rollup bundle them into your dist file.
* You can import other modules here, including external packages. When bundling using rollup you can mark those modules as external and have them excluded or, if they have a jsnext:main entry in their package.json (like this package does), let rollup bundle them into your dist file.
*
* IMPORTANT NOTE: If you are ultimately creating an iife/self executing bundle for the browser, be sure to:
* import 'babel-polyfill'
*
* at your application entry point. This is necessary for browsers that do not yet support some ES2015 runtime necessities such as Symbol. We do this in `index-iife.js` for our iife rollup bundle.
*/
/* eslint-disable no-unused-vars */
import 'babel-polyfill/dist/polyfill'
import 'bootstrap'
// invalidComponentMatches is currently disabled due to https://github.com/rollup/rollup/issues/428#issuecomment-170066452
import Checkbox from './checkbox'
import CheckboxInline from './checkboxInline'
import CollapseInline from './collapseInline'
import File from './file'
import Radio from './radio'
import RadioInline from './radioInline'
import Select from './select'
import Switch from './switch'
import Text from './text'
import Textarea from './textarea'
import './checkbox'
import './checkboxInline'
import './collapseInline'
import './file'
import './radio'
import './radioInline'
import './select'
import './switch'
import './text'
import './textarea'
import Drawer from './drawer'
import './drawer'
import Ripples from './ripples'
import Autofill from './autofill'
import BootstrapMaterialDesign from './bootstrapMaterialDesign'
/* eslint-enable no-unused-vars */
import './ripples'
import './autofill'
import './bootstrapMaterialDesign'

View File

@ -33,19 +33,20 @@
},
"license": "MIT",
"dependencies": {
"babel-polyfill": "^6.8.0",
"bootstrap": "twbs/bootstrap#v4-dev",
"extend": "^3.0.0",
"jquery": "^2.2",
"tether": "^1.3.2"
"babel-polyfill": "^6.8.0"
},
"devDependencies": {
"babel-core": "^6.8.0",
"babel-eslint": ">=6.0.4",
"babel-preset-es2015": "^6.6.0",
"bootstrap": "twbs/bootstrap#v4-dev",
"extend": "^3.0.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-pipeline": "^4.0.40",
"moment": "^2.13.0"
"jquery": "^2.2",
"moment": "^2.13.0",
"select2": "^4.0.2",
"tether": "^1.3.2"
},
"engines": {
"node": ">=0.10.1"