Skip to content
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

How should this interact with tools? #22

Open
littledan opened this issue Nov 8, 2019 · 4 comments
Open

How should this interact with tools? #22

littledan opened this issue Nov 8, 2019 · 4 comments

Comments

@littledan
Copy link
Member

JS build tools may be another place where module attributes could be given meaning. Would this be useful? Desirable for the ecosystem? Cc @jhnns @sokra @guybedford @xtuc @lukastaegert

@xtuc
Copy link
Member

xtuc commented Nov 11, 2019

Reposting my comment here:

I think another use case would be for tooling; transpilers could tune their code generation based on attributes for instance:

import {a} from "b" with parserPlugin: 'jsx';

or a bundler using loaders:

import {a} from "b" with loader: 'babel';

or bundlers using multiple loaders for the same type but not the same runtime representation:

import img from "./my_resource" with type: "image", as: "json";

This proposal allows arbitrary keys so it could be anything.

@JLHwung
Copy link
Contributor

JLHwung commented Nov 26, 2019

Bundlers use multiple loaders with configurations:

import Styles from "./styles.css" with loaders: [
  { loader: "style" },
  { loader: "css", options: { modules: true } }
];

The example is taken from Webpack Loaders Doc.

@xtuc
Copy link
Member

xtuc commented Nov 26, 2019

The syntax is being discussed in #6 #3 #12, but it will likely only allow primitive types.

@littledan
Copy link
Member Author

This isn't the first time I've heard the idea of JSON-like data in module attributes. It might be worth more consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants