Comments (6)
The plugin supports only default exports and I'm not going to support named exports. Also It's not very clear why do you want to export func1 and func2 and then export an object with such keys? Since exported stuff is exported as is (doesn't contain __esModule
and default
keys) I cannot see any use cases of repeating these exports as named.
from babel-plugin-transform-es2015-modules-simple-amd.
Indeed.
Seems that named exports are supported by the way.
Source:
import { func1 as f1 } from './actual';
import actual from './actual';
console.log(f1);
console.log(actual);
Target:
'use strict';
define(['./actual', './actual'], function (_actual, actual) {
var f1 = _actual.func1;
console.log(f1);
console.log(actual);
});
//# sourceMappingURL=actualR.js.map
from babel-plugin-transform-es2015-modules-simple-amd.
Also It's not very clear why do you want to export func1 and func2 and then export an object with such keys?
- It's an ultimate case that is valid from ES6 point of view.
- Generated by transpiler code must be valid or the transpiling process should fail. Now generated files are invalid from ES5 point of view.
- Say we have a case where the module is consumed by 3rd party AMD-module but also is used inside the project that is ES6 modules-compatible. Named exports are really useful from static checking point of view.
import { func3 } from './actual'
will be treated as an error by linter (e.g. via "eslint-plugin-import")
from babel-plugin-transform-es2015-modules-simple-amd.
The plugin is not an ideal thing and for me it makes sense as stupid AMD transpiler with default exports (AMD doesn't have things which I can call named exports).
There can be added a lot of features (like there) but your PR doesn't cover any full feature but covers only one weird use case. Also I'm not really interested to maintain this thing by myself because AMD is dying. Sorry, I'm not going to accept your PR. Feel free to fork and publish your own version of the plugin
from babel-plugin-transform-es2015-modules-simple-amd.
Your plugin is awesome and especially if we are talking about migrating from dying AMD to shiny ES6 modules.
Standard babel AMD plugin is useless as it can't provide soft migration from AMD based frameworks (like dojo).
The case that I covered allows to use cool feature as named exports in a new project without touching old libs for transition period of time.
Please reconsider a possibility to merge.
PS: the link you provided redirect to your GitHub project page.
from babel-plugin-transform-es2015-modules-simple-amd.
Please reconsider a possibility to merge.
Please make your own package. I'm not going to add features anymore.
PS: the link you provided redirect to your GitHub project page.
Yes, I wanted to say that the project is also created for migrating but all changes made to the plugin are full. Your PR removes named export by declaration node which makes potential bugs for other users (they could want to use named exports but they get nothing instead of syntax error).
from babel-plugin-transform-es2015-modules-simple-amd.
Related Issues (8)
- Code after "export default" is gnored
- use it with new babel? HOT 2
- Is babel-template a dependency? HOT 4
- [feature request] support for non-default exports / imports HOT 3
- Transform class definitions into declare statements for Dojo HOT 2
- import Default, {others..} not supported HOT 1
- export default class is not working
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 babel-plugin-transform-es2015-modules-simple-amd.