Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce rollup bundler #326

Merged
merged 1 commit into from
Jan 1, 2020
Merged

introduce rollup bundler #326

merged 1 commit into from
Jan 1, 2020

Conversation

midzer
Copy link
Contributor

@midzer midzer commented Jan 1, 2020

Hi again,

here's a setup to bundle bsn with rollup. Babel with preset-env is used to transpile JS. I've tested dist JS files only for Drowndown functionality until now.

The next days I'm going to import individual components in a project to see how this works out.

Cheers
midzer

@thednp thednp merged commit 320b553 into thednp:master Jan 1, 2020
@thednp
Copy link
Owner

thednp commented Jan 1, 2020

Thanks so much for your contribution, amazing work :)

@midzer
Copy link
Contributor Author

midzer commented Jan 1, 2020

Thanks. Been great fun. I had a (hopefully good) sample rollup.config.js at hand ;)

I am thinking about moving src folder and containing index.js to root as well.
This way, you should be able to just do

import BSN from 'bootstrap.native'

and import individual components via

import Alert from 'bootstrap.native/src/alert-native.js'

What do you think about that?

@thednp
Copy link
Owner

thednp commented Jan 2, 2020

Don't worry about those, you took the thoughts out of my mind. I have some other questions:

  • Is the _classCallCheck required for the ES5 build to work, can we just remove it somehow? Perhaps we could do for instance function Alert(element){} instead of constructor(element){}?
  • Is it possible to export components to window on the ES5 build? We don't want to upset people that might have to change new Tooltip(element) to new BSN.Tooltip(element).
  • Just like the above, is it possible to expose initCallback() and removeCallback() to window.BSN folder, just like in our previous builds?
  • Can we have an optional build option for included components [alert,button] similar to the previous build script?
  • Can we order required utils to functions first then vars?
  • Can we set a custom text indentation for the build, the way babel works is kinda sloppy? Or is anything we can do about it?
  • Similar to original plugins, can we also do an esm build? Can we also do a bundle to include polyfills (those will need to be lebabified)?

If I have other questions, don't miss them :)

@thednp
Copy link
Owner

thednp commented Jan 2, 2020

To answer my own question, I found that export default function Alert(element){} seems to do the job. What do you think about that?

@thednp
Copy link
Owner

thednp commented Jan 2, 2020

I think I figured on how to do ESM as well.

@midzer midzer deleted the rollupBundle branch January 2, 2020 09:26
@midzer
Copy link
Contributor Author

midzer commented Jan 2, 2020

Tough and good questions! As I'm just learning rollup myself, I have to investigate more deeply.

A checklist in #306 would be helpful what tasks are still to be done and others might help out as well.

Meanwhile, until you push your new findings, I'm going to look for other libraries which do rollup and esm modules, too.

Sorry of being of no help right now. Let's solve remaining aspects together.

@thednp
Copy link
Owner

thednp commented Jan 2, 2020

@midzer will do asap

@thednp thednp mentioned this pull request Jan 2, 2020
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants