icecreamliker / requirejs-babel-plugin Goto Github PK
View Code? Open in Web Editor NEWA better RequireJS plugin for babel
License: MIT License
A better RequireJS plugin for babel
License: MIT License
Hi,
Can you add support for the "empty:" path? Take a look at the requirejs text plugin for example...
https://github.com/requirejs/text/blob/master/text.js line 197- 200
Thanks!
modules
was deprecated in Babel 6. I suggest removing it from the default options and then making the user able to choose between Babel 5 or Babel 6 by setting the appropriate settings in main.js
See PR #3
Hi,
Facing an issue with this plugin regarding source maps. I am not sure if this is a babel-core issue or what but figured I would start here.
In my require config I am importing babel like so:
'es6': "libs/node_modules/requirejs-babel-plugin/es6",
'babel': "libs/node_modules/babel-standalone/babel"
When I require es6!my_module_name it works correctly and a source map is generated. However if my_module_name has dependencies such as
define([
'backbone',
'text!app/template.html',
'es6!app/dep1',
'es6!app/dep2',
'es6!app/dep3',
'webui-popover'
], function(Backbone, template, dep1, dep2, dep3, webuiPopover)
(and maybe dep1, 2, or 3 has the same sort of structure)
The source map reported by chrome will be the incorrect name. For example, if in dep1 I have a console.log('hi'); chrome will say the console.log is coming from dep3 even though it should be dep1. I have noticed if I remove dep3 from the define, the above statement will then then say the console.log is coming from dep2.
Should this be working?
Let me know if something is unclear. If needed I can try and put together a sample
When removing fileExtension here https://github.com/icecreamliker/requirejs-babel-plugin/blob/master/es6.js#L54 you effectively remove it from the configuration object. Therefore if you use .jsx
as fileExtension only the first require will actually be transformed. On subsequent requires the option is missing and will be interpreted as normal .js
I made a PR #1
Babel option resolveModuleSource to insert es6! prefix to imported dependencies is not working because deep clone of babel config with JSON stringify/parse will remove functions from options. Quick fix would be something like
babelOptions = JSON.parse(JSON.stringify(config.babel));
babelOptions.resolveModuleSource = config.babel.resolveModuleSource
See also issue mikach/requirejs-babel#26
I am transpiling ES6 files using Gulp to activate Babel (with plugin 'transform-es2015-modules-amd').
I am unable to specify logical paths for requirejs, for example:
require.config({
paths: {
'react': '../lib/react.min.js',
'react-dom': '../lib/react-dom.min.js',
},
})
I am hoping this plugin can help me to specify these requirejs options into the ES5 files produced by Babel.
Where exactly should I put the config info?
If I try naively to put it at the start of the first ES6 file, Babel moves the require.config instruction inside the define
block, whereas I need it to remain outside.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.