Comments (14)
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.
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.
I just have to push it up, need a little bit longer
from babelify.
This works for me: ignore: [/^(?!.*\/node_modules\/app\/)/]
from babelify.
I can confirm that babelify does not globally transform node_modules
if you specify { global: true }
.
from babelify.
@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.
@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.
@niftylettuce I was just starting to go down that same path but got sidetracked. Please share! 🥗
from babelify.
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.
OK it's done. v0.2.9 of Lad has an updated gulp config that satisfies our needs here.
npm install -g lad
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.
@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.
any news about this ?.......
from babelify.
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.
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)
- 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
- 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.