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

v4 Alpha 3 references nonexistent dist/js/npm.js in package.json #20383

Closed
TheSharpieOne opened this issue Jul 27, 2016 · 8 comments
Closed

v4 Alpha 3 references nonexistent dist/js/npm.js in package.json #20383

TheSharpieOne opened this issue Jul 27, 2016 · 8 comments

Comments

@TheSharpieOne
Copy link

TheSharpieOne commented Jul 27, 2016

The v4 alpha 3 (just released) npm package does not contain as ./dist/js/npm referenced in the package.json.
This causes problems when requiring or importing the bootstrap package via npm.
I am not sure if the file is missing or purposely removed (in which case the package.json would need to be updated)

Update:
Commit which removed the file: ce2e944

@cvrebert cvrebert changed the title v4 Alpha 3 missing dist/js/npm.js v4 Alpha 3 references nonexistent dist/js/npm.js in package.json Jul 27, 2016
@cvrebert cvrebert added this to the v4.0.0-alpha.4 milestone Jul 27, 2016
@mdo mdo modified the milestones: v4.0.0-alpha.4, v4.0.0-alpha.3.1 Aug 2, 2016
@mdo
Copy link
Member

mdo commented Aug 2, 2016

@cvrebert Is this something we need to restore, or is there another solution here? I'm unsure what I can do to resolve this and, if there's a fix, I'd like to include it in the "alpha patch" I've queued up.

@nicolashery
Copy link

I'm not entirely sure about the decision to only ship ES6 files in the npm package, introduced by #20072...

In the application I'm working on, we do indeed have Babel + Webpack, but we only run it on our own source files (and with Babel presets specific to our project, since there are different "flavors" of ES6). All the packages in our node_modules/ are already pre-transpiled to ES5 (React, etc.). I have yet to come across an npm package that only publishes ES6 source files (I guess you can publish both ES5 and ES6 if you'd like).

Our use-case is that we only bundle the JS we need from Bootstrap. An example from one of our Webpack entry points:

window.jQuery = require('jquery');
require('bootstrap/dist/js/umd/dropdown.js');

This would work if we required ES5 CommonJS (it doesn't have to be UMD), but it wouldn't if it was ES6.

Long story short, I would publish on npm:

  • dist/js/bootstrap.js (and bootstrap.min.js): the ES5 UMD build (usable by any setup, can also point the package.json main to this)
  • lib/dropdown.js, etc.: the transpiled ES5 CommonJS modules, usable by Webpack, Browserify etc. (without forcing Babel, can cause headaches if you don't have the right Babel version or are not using the right presets)
  • (optionally) src/dropdown.js, etc.: the original ES6 modules

(Folder names are given as example, feel free to change them.)

Others may have different opinions, but I just wanted to raise a flag on publishing only the ES6 modules and full UMD build 😄 I think we should also have the ES5 CommonJS.

@cvrebert
Copy link
Collaborator

cvrebert commented Aug 4, 2016

@mdo No need to resurrect anything. Probably we should change main to point at dist/js/bootstrap.js (or maybe the minified version; will try to do some looking soon).

@maxbeatty
Copy link
Contributor

we should change main to point at dist/js/bootstrap.js

looks like #20394 is doing just that

@yvbeek
Copy link

yvbeek commented Aug 16, 2016

I am having the same issue as @TheSharpieOne, it is kinda unfortunate that I have to go back to alpha2 because of it. Or does anyone have a workaround for this?

Small side-question: why is it still called an alpha? Isn't it stable enough to call it a beta? Or do you want to call it a beta when most of the breaking changes have been released?

@TheSharpieOne
Copy link
Author

TheSharpieOne commented Aug 16, 2016

@Zyphrax the current workaround is to change import 'bootstrap'; to import 'bootstrap/dist/js/bootstrap'; (referencing the file directly).
Or if you are not using the es2015 module syntax: change require('bootstrap') to require('bootstrap/dist/js/bootstrap'); This workaround works for me.
I cannot/should not really speak to the alpha beta thing, but yes, I believe it is still alpha because there are still some components which have not need fully flushed out in v4 and breaking changes happen all of the time (usually for good reasons #notcomplaining).

@yvbeek
Copy link

yvbeek commented Aug 17, 2016

Thank you. I'm importing the (s)css of Bootstrap in my project (es6 notation). That seems to trigger Webpack to include the javascript code of Bootstrap and then throws an error that the bootstrap module could not be found. I'm not really sure how I can work around that.

@mdo
Copy link
Member

mdo commented Aug 22, 2016

Merged #20394, and followed up with #20552, to update the package.json in v4-dev. Working with the team to find a date to ship the next release.

@mdo mdo closed this as completed Aug 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants