Giter VIP home page Giter VIP logo

Comments (6)

finom avatar finom commented on August 18, 2024

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.

tfactor2 avatar tfactor2 commented on August 18, 2024

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.

tfactor2 avatar tfactor2 commented on August 18, 2024

Also It's not very clear why do you want to export func1 and func2 and then export an object with such keys?

  1. It's an ultimate case that is valid from ES6 point of view.
  2. Generated by transpiler code must be valid or the transpiling process should fail. Now generated files are invalid from ES5 point of view.
  3. 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.

finom avatar finom commented on August 18, 2024

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.

tfactor2 avatar tfactor2 commented on August 18, 2024

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.

finom avatar finom commented on August 18, 2024

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)

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.