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

.mjs file ending mixup #240

Closed
MrAndersen1 opened this issue Jan 2, 2023 · 2 comments · Fixed by #243
Closed

.mjs file ending mixup #240

MrAndersen1 opened this issue Jan 2, 2023 · 2 comments · Fixed by #243
Labels
bug Something isn't working

Comments

@MrAndersen1
Copy link

I have a deno project which imports XLSX like this

// @deno-types="https://cdn.sheetjs.com/xlsx-0.19.1/package/types/index.d.ts"
import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.19.1/package/xlsx.mjs';

After I build it with dnt using

import { build, emptyDir } from "https://deno.land/x/dnt@0.32.1/mod.ts";
await emptyDir("../out");
await build({
	entryPoints: ["./src/index.ts"],
	outDir: "../out",
	shims: {
		deno: true
	},
	package: {
		name: "myPackageName",
		version: "1.0.0"
	}
});

I end up with a file (Note the file ending .mjs)

[absolutePath]/out/script/deps/cdn.sheetjs.com/xlsx-0.19.1/package/xlsx.mjs

while

[absolutePath]/out/script/[file-with-the-import-in].js

contains (Note the file ending .js)

const XLSX = __importStar(require("./deps/cdn.sheetjs.com/xlsx-0.19.1/package/xlsx.js"));

Resulting in an error.

If I manually change the file to .js instead of .mjs it works as expected. I'm guessing this is a bug somewhere with dnt? But I'm not sure.

@dsherret dsherret added the bug Something isn't working label Jan 9, 2023
@MrAndersen1
Copy link
Author

Nice. I will test this when we get the next version.

@MrAndersen1
Copy link
Author

It works fine for me now 👍 thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants