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 anchors from 'anchor-js'
// import all the bmd code // 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 { class Application {

View File

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

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 * 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.
* 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 * IMPORTANT NOTE: If you are ultimately creating an iife/self executing bundle for the browser, be sure to:
* this package does), let rollup bundle them into your dist file. * 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' import 'bootstrap'
// invalidComponentMatches is currently disabled due to https://github.com/rollup/rollup/issues/428#issuecomment-170066452 // invalidComponentMatches is currently disabled due to https://github.com/rollup/rollup/issues/428#issuecomment-170066452
import Checkbox from './checkbox' import './checkbox'
import CheckboxInline from './checkboxInline' import './checkboxInline'
import CollapseInline from './collapseInline' import './collapseInline'
import File from './file' import './file'
import Radio from './radio' import './radio'
import RadioInline from './radioInline' import './radioInline'
import Select from './select' import './select'
import Switch from './switch' import './switch'
import Text from './text' import './text'
import Textarea from './textarea' import './textarea'
import Drawer from './drawer' import './drawer'
import Ripples from './ripples' import './ripples'
import Autofill from './autofill' import './autofill'
import BootstrapMaterialDesign from './bootstrapMaterialDesign' import './bootstrapMaterialDesign'
/* eslint-enable no-unused-vars */

View File

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