Giter Club home page Giter Club logo

Comments (14)

TidyLuke avatar TidyLuke commented on May 27, 2024 3

I can't seem to get this to work at all. The global option no longer works, setting ignores in my gulpfile does not work, removing my config into babel.config.js or babel.config.json does not work. I'm stumped as to how I can transfom a package. Any help would be greatly appreciated.

from babelify.

Maxim-Mazurok avatar Maxim-Mazurok commented on May 27, 2024 3

Gentlemen, I believe we all have been deceived by Windows once again.
I've added some logging and noticed that we have \ instead of / in filename:

babelOpts: {
    ignore: [ /node_modules\/(?!whatwg-fetch)/ ],
    presets: [ [Array] ],
    assumptions: { arrayLikeIsIterable: true },
    sourceType: 'module',
    cwd: 'C:\\Users\\maxim\\browserify-temp',
    caller: { name: 'babelify' },
    filename: 'C:\\Users\\maxim\\browserify-temp\\node_modules\\core-js\\internals\\to-object.js',
    sourceFileName: undefined
  }

So the fix is to make it platform-independent:

ignore: [/[/\\]node_modules[/\\](?!whatwg-fetch[/\\])/],

Hope it helps!

from babelify.

niftylettuce avatar niftylettuce commented on May 27, 2024 1

I just have to push it up, need a little bit longer

from babelify.

jean-emmanuel avatar jean-emmanuel commented on May 27, 2024

This works for me: ignore: [/^(?!.*\/node_modules\/app\/)/]

from babelify.

niftylettuce avatar niftylettuce commented on May 27, 2024

I can confirm that babelify does not globally transform node_modules if you specify { global: true }.

from babelify.

builtbylane avatar builtbylane commented on May 27, 2024

@niftylettuce I am seeing this too. I'm not able to transform any of the required node_modules. even when I set {global: true, ignore: undefined }

from babelify.

niftylettuce avatar niftylettuce commented on May 27, 2024

@builtbylane I have a pretty cool solution/alternative that even has factor-bundle built-in. Will share soon. IMO there is a core bug somewhere here that nobody has figured out or dedicated time to. Obviously this is broken. The better solution is to run browserify and then babel separately.

from babelify.

builtbylane avatar builtbylane commented on May 27, 2024

@niftylettuce I was just starting to go down that same path but got sidetracked. Please share! 🥗

from babelify.

loganfsmyth avatar loganfsmyth commented on May 27, 2024

Assuming you're using Babel 7:
It is hard to say since this didn't specify how it is configuring things, but everything in https://babeljs.io/docs/en/config-files applies here. If you're using a .babelrc file, it is still package-scoped, even if you run the transform itself with global: true, so make sure you're using a babel.config.js,

from babelify.

niftylettuce avatar niftylettuce commented on May 27, 2024

OK it's done. v0.2.9 of Lad has an updated gulp config that satisfies our needs here.

npm install -g lad

https://lad.js.org

https://github.com/ladjs/lad/blob/master/template/gulpfile.js#L181-L199

Happy hacking, and feel free to join our Slack @ https://slack.crocodilejs.com/

from babelify.

builtbylane avatar builtbylane commented on May 27, 2024

@loganfsmyth I've changed my config file to babel.config.js to no avail. Babelify still doesn't honor my settings for the node_modules

from babelify.

romain130492 avatar romain130492 commented on May 27, 2024

any news about this ?.......

from babelify.

vielhuber avatar vielhuber commented on May 27, 2024

Does anybody know how the ignore pattern can be used inside npm scripts on the command line?

I have this in my npm scripts:

"js": "browserify script.js --outfile bundle.js -t [ babelify --global --ignore [ node_modules\/(?!swiper) ] ]",

Result:
Syntax error: "(" unexpected

"js": "browserify script.js --outfile bundle.js -t [ babelify --global --ignore [ node_modules\/\\(?!swiper\\) ] ]",

Result:
Doesn't work, since it does not properly ignore all packages except the defined ones.

from babelify.

vielhuber avatar vielhuber commented on May 27, 2024

Just found a clever way:

"js": "browserify script.js --outfile bundle.js -t [ babelify --global --only [ _js node_modules\/swiper ] ]",

You can define more packages to transform by adding them (space separated) to the array of only.

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.