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

Module (mjs) output isn't valid #15

Open
freshollie opened this issue Dec 8, 2021 · 1 comment
Open

Module (mjs) output isn't valid #15

freshollie opened this issue Dec 8, 2021 · 1 comment

Comments

@freshollie
Copy link

Trying to use this library with webpack, the "module" entry point is used for better try shaking (good :D)

Unfortunately, it looks like your mjs output is a bit mangled. I think your .mjs entry point is ending up pointing to the cjs files, as they are both output to the same directory.

Maybe at some point this library only had 1 file?

index.mjs

import FetchCache from './FetchCache';
export * from './defaultTTL';
export default FetchCache;
//# sourceMappingURL=index.js.map

Points to './FetchCache.js', which is in commonjs format

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const hamster_cache_1 = require("@sozialhelden/hamster-cache");
const defaultTTL_1 = require("./defaultTTL");
...
exports.default = FetchCache;
@mwaddell
Copy link

mwaddell commented Nov 7, 2022

I'm getting the same error when trying to use this in a React project:

Failed to compile.

Module not found: Error: Can't resolve './defaultTTL' in '/home/mwaddell/Projects/firestorm2gui/node_modules/@sozialhelden/fetch-cache/dist'
Did you mean 'defaultTTL.js'?
BREAKING CHANGE: The request './defaultTTL' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.


error Command failed with exit code 1.

Is there a workaround for this?

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

No branches or pull requests

2 participants