Comments (10)
Are you using the node API or the CLI?
from babelify.
Node, or gulp more specifically
from babelify.
browserify().add(require.resolve("6to5/browser-polyfill"))
should work.
from babelify.
Hmm.. I tried changing my watchify browserify task to the following:
gulp.task("browserify", function() {
browserify(p.jsx)
.add(require.resolve("6to5/browser-polyfill")) // <-- Added line
.transform(reactify)
.transform(to5Browserify)
.bundle()
.pipe(source(p.bundle))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest(p.distJs));
});
But I get: "Error: Cannot find module '6to5/browser-polyfill'" when I run it :(
I've tried "6to5-browserify/browser-polyfill" as well
Am I way off or something?
from babelify.
I believe it's just require('6to5/polyfill')
from babelify.
I don't have a node_module called "6to5", I only have "6to5-browserify", since I want to use it in browser, not in node. Do I need to npm install the non-browserify version of 6to5 to be able to require the polyfill?
from babelify.
@thejameskyle Doh, you're right. That's much better.
@hummlas Yeah you do. npm install --save 6to5
. Don't worry about multiple copies of 6to5 being installed because 6to5-browserify
will use to the one you installed.
from babelify.
@sebmck @hummlas That should probably be npm install --save-dev 6to5
as 6to5 is generally a devDependency.
from babelify.
@sebmck @thejameskyle I got it working with your help, thank you very much :)
from babelify.
@hummlas Great! Check out the gitter room if you run into anymore issues.
from babelify.
Related Issues (20)
- Babel 7 Stable Released HOT 8
- Bundling hyperhtml-element with browserify/babelify not working
- transform-arrow-functions being ignored for external packages? HOT 5
- TypeError: extensions.indexOf is not a function
- TypeError: Cannot read property 'canCompile' of undefined HOT 5
- How to get babelify && preset-env to convert 'const' HOT 3
- Boolean options fail (e.g. --compact true) HOT 1
- usage of babel/polyfills HOT 4
- Not working "Why aren't files in node_modules being transformed?" HOT 14
- Use a Bundler for Development? HOT 1
- tsify + babelify + browserify with threejs modules: SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (9:0) HOT 17
- Is it possible to disable asyncToGenerator? HOT 2
- TypeError: Cannot read property 'arrayify' of undefined HOT 2
- Is this incompatible with Babel 7? HOT 3
- If I don't specify any Babel plugins or presets, what exactly should happen? HOT 6
- Continued problems with issue #103 ('import' and 'export' may appear only with 'sourceType: module') HOT 4
- How to use with globally installed browserify? HOT 1
- No source being transformed HOT 1
- babelify + gulp with threejs modules: SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (9:0)
- 'import' and 'export' may appear only with 'sourceType: module' (14:0)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babelify.