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

Add API alias options #490

Closed
wants to merge 1 commit into from
Closed

Add API alias options #490

wants to merge 1 commit into from

Conversation

legendecas
Copy link
Contributor

Exposing alias options allowing to map one module to another and bundle the mapped module into the final archive.

Rollup alternatives: https://github.com/rollup/plugins/tree/master/packages/alias

Related: #460

if (Array.isArray(aliasMap))
alias.forEach(alias => aliasMap[alias[0]] = alias[1]);
else if (typeof alias === 'object')
Object.keys(alias).forEach(from => aliasMap[from] = alias[from]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Object.keys(alias).forEach(from => aliasMap[from] = alias[from]);
aliasMap = alias;

I think you can avoid iteration here an assign instead

Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use case for this? Should there be a CLI option too?

@styfle styfle closed this Mar 23, 2020
@morgs32
Copy link

morgs32 commented Jul 25, 2020

I'm interested in this - wondering if it would enable transpiling other packages in a yarn workspace/monorepo? For example:

// packages/package1.js

import utils form 'package2'

If the main in package2's package.json is es6 or typescript, could it still be transpiled if we alias'd to it with a relative path instead of referencing the same package via node_modules in a yarn workspace (which points to the directory via symlink)

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

Successfully merging this pull request may close these issues.

3 participants