Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

ESM output support #2018

Open
charsleysa opened this issue Jun 10, 2021 · 3 comments
Open

ESM output support #2018

charsleysa opened this issue Jun 10, 2021 · 3 comments
Labels
compiler Fuse Compiler related issues enhancement Feature

Comments

@charsleysa
Copy link
Contributor

Are there any plans for supporting ESModule output?

I see a lot of other tools and packages are switching the ESModule output, some exclusively only output ESModule and ditching UMD/AMD/CommonJS.

Would be great if fuse-box supported this as we are looking to switch over to ESModule output.

@charsleysa charsleysa added enhancement Feature compiler Fuse Compiler related issues labels Jun 10, 2021
@jpike88
Copy link
Contributor

jpike88 commented Jun 10, 2021

If anyone is having issues pulling in ESM modules into fusebox for the time being, use a library like simport which will make that lib compatible with fusebox.

Here's an example using 'p-queue', a pure ESM lib (and synchronised promise so it could be run on top level)


import PQueue from 'p-queue';
import sp from 'synchronized-promise';
import { createSimport } from 'simport';

const simport = createSimport(__filename);

const importPqueue = () => {
	return new Promise(async (resolve) => {
		const pqueueImport = await simport('../node_modules/p-queue/dist/index.js');
		resolve(pqueueImport.default);
	});
};

const queue: PQueue = new ((sp(importPqueue) as any)())({ concurrency: 1 });

@nchanged
Copy link
Contributor

I think for the output you're supposed to use some other tool. Not a bundler.

@paxperscientiam
Copy link
Contributor

@charsleysa , perhaps you could create a plugin that leverages microbundle?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler Fuse Compiler related issues enhancement Feature
Projects
None yet
Development

No branches or pull requests

4 participants