Questions tagged [babelify]

Babelify plugs Babel's transpilation tools into the Browserify pipeline.

53 questions
28
votes
5 answers

Couldn't find preset "env" relative to directory

So far I have been unsuccessful in an attempt to use the env preset. I browsed the git issues that others have raised such as this, and implemented some of the suggestions that appeared to work for others, but no luck so far. Here's what I'm working…
skwny
  • 2,930
  • 4
  • 25
  • 45
8
votes
2 answers

Yarn Workspaces and Browserify - package.json in subfolder breaks the build

My ultimate goal is to use Yarn Workspaces in a project using Browserify and Babel 7. This is a minimal reproduction of a problem I'm having. Basically it seems that the presence of a package.json file in a subfolder (which is one of the things that…
dumbmatter
  • 9,351
  • 7
  • 41
  • 80
6
votes
2 answers

Unable to import CSS with "babel-plugin-react-css-modules" - get "ParseError: Unexpected token"

Please see https://github.com/gajus/babel-plugin-react-css-modules/issues/162 for full description of issue. Git repo = https://github.com/basher/react-no-webpack This is a simple POC / scaffold for a React UI lib without Webpack or Gulp but it must…
5
votes
1 answer

Passing "global" and "ignore" options to browserify via the command line

I'm using browserify with babelify to transpile a JS file. The JS file require()s a component in node_modules, which I also want transpiled. As per the FAQ on babelify's GitHub, to achieve this I should be using the global and ignore options to…
Elise
  • 5,086
  • 4
  • 36
  • 51
5
votes
1 answer

Create an embeddable widget using React

I have a small form component built using React that I want to make into an embeddable widget for use on other pages. I believe I heard Babelify can help accomplish this, but I'm honestly drawing a blank on how to get this working. I used Babelify…
demluckycharms
  • 421
  • 1
  • 6
  • 17
4
votes
2 answers

Grunt build failing - ParseError: 'import' and 'export' may appear only with 'sourceType: module'

I have gone through many posts on github and stackoverflow. I have the following dev dependencies in my package.json for the es6 to es5 transpilation. "babel-cli": "^6.26.0", "babel-core": "^6.26.0", "babel-loader":…
Rajesh Dwivedi
  • 382
  • 2
  • 13
3
votes
1 answer

Another ParseError: 'import' and 'export' may appear only with 'sourceType: module' :(

I have spent days scouring the internet and SO for a solution to this issue (please don't mark this as duplicate!). I am trying to use ES6 imports: import * as _ from 'underscore'; <--- works const test = _.clone({'2':1}); <---…
Liz
  • 1,421
  • 5
  • 21
  • 39
2
votes
0 answers

Browserify + Gulp + Babelify ~ import' and 'export' may appear only with 'sourceType: module

I'm working on a project and want to use gulp to automate some tasks, to compile js and other code. I'm using Browserify and Babelify in combination with the babel-eslint to set my sourcetype to module however i still get this ParseError when I'm…
Michael Rotteveel
  • 89
  • 1
  • 3
  • 13
2
votes
0 answers

How to get babelify 10 to target a browser

What I want is To be using the latest versions of the libraries. For it to run in IE 11. I'm building a react app and in order to run the tests I need @testing-library/react. In order to run the tests in a browser I need browserify. In order to…
SkySpiral7
  • 362
  • 3
  • 8
2
votes
0 answers

Watchify compile once wrongly and then stops

I'm on Windows 10 x64, the sources are on a NFS unit. When i run the script it gives me this: npm run-script watch > fooprog@1.0.0 watch U:\fooprog > watchify -v --poll index.js -o ./dist/main.js 471 bytes written to ./dist/main.js (0.01 seconds)…
Blallo
  • 450
  • 3
  • 11
2
votes
1 answer

Importing class from module

I am trying to import a class from a module that I want to use in a browser. For this purpose I created an MCVE to check my understanding, though I get an Uncaught SyntaxError: The requested module './test-class-bundle.js' does not provide an export…
Henriette Harmse
  • 4,167
  • 1
  • 13
  • 22
2
votes
0 answers

How to use the minify preset with babelify on babel 7?

I installed the following packages: npm install --save-dev babelify@next @babel/core @babel/preset-env babel-preset-minify I can successfully browserify my NodeJS Express app with: ./node_modules/browserify/bin/cmd.js src/app.js -o src/bundle.js…
villasv
  • 6,304
  • 2
  • 44
  • 78
2
votes
0 answers

Gulp JS task fails when images or css are imported into React component

I'm fairly new with gulp but I don't understand why my javascript gulp task fails when css or images are imported. SVG image: $ gulp js Using gulpfile ~/Project/gulpfile.js Starting 'js'... Error : Project/logo.svg:1
nachomacaso
  • 35
  • 1
  • 5
2
votes
1 answer

Babelify imports in a reactJS application does not replace let declarations to var

I built a small ReactJS application that runs in the browser, i am having issues with older browser versions (especially on iOS devices), the application is built with node and browserify/babelify I have the following gulpfile…
Eyal Alsheich
  • 452
  • 4
  • 12
2
votes
2 answers

How do I disable babel minification when not in production?

I am using babelify and babili for JS minification, via gulp: // Now run the watchifys function for this bundle watchifysForBundle[jsBundle] // Note: we don't use any babel presets - instead we just write code in what evergreen browsers support …
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
1
2 3 4