Skip to content

add module:ignore option #3300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bidiboom opened this issue May 29, 2015 · 8 comments
Closed

add module:ignore option #3300

bidiboom opened this issue May 29, 2015 · 8 comments
Labels
Needs More Info The issue still hasn't been fully clarified Suggestion An idea for TypeScript

Comments

@bidiboom
Copy link

Hi,
when using ES6 module spec and try to generate ES5 code, the compiler invite me to specify a module type for the output : amd|commonjs. Is it possible to add ignore like in babeljs so we can concatenate output into a single file without having to use an extra tool to do the operation please ?

@mhegazy
Copy link
Contributor

mhegazy commented May 29, 2015

can you specify more details on the generated output. so how would import * from "module" or export default function foo(){} be emitted?

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Needs More Info The issue still hasn't been fully clarified labels May 29, 2015
@bidiboom
Copy link
Author

Hello!

it seems they just strip module information as seen here in documentation : https://babeljs.io/docs/usage/modules/

They gave an example :

import foo from "foo";

export function bar() {
  return foo("foobar");
}

Will give :

function bar() {
  return foo("foobar");
}

It is probably not as robust as you may want.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 24, 2015

I am not sure i understand how this is meant to be used later. looking at babel's output in this case:

import {foo  as foobar} from "foo";

export function bar() {
  return foobar("foobar");
}

emits with --m ignore:

"use strict";

exports.bar = bar;
Object.defineProperty(exports, "__esModule", {
  value: true
});

var foobar = require("foo").foo;

function bar() {
  return foobar("foobar");
}

so you still have a call to require; if that is fine, just use --m commonjs.

@bidiboom
Copy link
Author

Hi,

let me talk to you about my use case, it will probably help to understand why i hope to have this kind of feature (and for for your time by the way!). I'm coding using ES6 module and i want to be able to produce ES5 code without having to use commonjs or AMD module things the same way we can do using Typescript module.

For now, i must use a third party solution (babel for example) in order to have ES5 code without this external module things. Since we can do it with Typescript module, i was hopping that we can also ask to the compiler to output ES5 code without having to depend on commonjs/amd/...

To come back to mhegazy, i didn't included a librairie to handle those require calls. They may be changed it, i'll check this point to see if the ES5 code rely on another component in order to load

@DanielRosenwasser
Copy link
Member

Hi @bidiboom, are you asking for us to concatenate the code of imported modules in place of loading them at runtime?

@mhegazy
Copy link
Contributor

mhegazy commented Jul 20, 2015

@bidiboom what is the difference between --m ignore and --m commonjs in your scenario ?

@bidiboom
Copy link
Author

Hi!

Sorry for responding this late. Wasn't around for some time. Actually after reading some other opened items i saw this one #17 which is exactly what i want to achieve with this kind of options.

I suggested the module:ignore to achieve what is described in the ticket (be able to concatenate every file into a single one).

@mhegazy
Copy link
Contributor

mhegazy commented Sep 11, 2015

i see. closing this then in favor of #17.

@mhegazy mhegazy closed this as completed Sep 11, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs More Info The issue still hasn't been fully clarified Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants