Git Product home page Git Product logo

Comments (10)

sebmck avatar sebmck commented on May 18, 2024

Are you using the node API or the CLI?

from babelify.

Markus-ipse avatar Markus-ipse commented on May 18, 2024

Node, or gulp more specifically

from babelify.

sebmck avatar sebmck commented on May 18, 2024
browserify().add(require.resolve("6to5/browser-polyfill"))

should work.

from babelify.

Markus-ipse avatar Markus-ipse commented on May 18, 2024

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.

jamiebuilds avatar jamiebuilds commented on May 18, 2024

I believe it's just require('6to5/polyfill')

from babelify.

Markus-ipse avatar Markus-ipse commented on May 18, 2024

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.

sebmck avatar sebmck commented on May 18, 2024

@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.

jamiebuilds avatar jamiebuilds commented on May 18, 2024

@sebmck @hummlas That should probably be npm install --save-dev 6to5 as 6to5 is generally a devDependency.

from babelify.

Markus-ipse avatar Markus-ipse commented on May 18, 2024

@sebmck @thejameskyle I got it working with your help, thank you very much :)

from babelify.

sebmck avatar sebmck commented on May 18, 2024

@hummlas Great! Check out the gitter room if you run into anymore issues.

from babelify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.