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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load minified ES6 module #8629

Open
thdoan opened this issue Nov 14, 2022 · 1 comment
Open

Cannot load minified ES6 module #8629

thdoan opened this issue Nov 14, 2022 · 1 comment
Labels
馃悰 Bug 馃悺 JS Codegen 馃尦 Scope Hoisting Stale Ignore This issue is exempt from getting flagged as stale and autoremoved

Comments

@thdoan
Copy link

thdoan commented Nov 14, 2022

馃悰 bug report

Parcel fails to import the ES6 version of tweenjs.

馃帥 Configuration (.babelrc, package.json, cli command)

{
  "devDependencies": {
    "@parcel/packager-raw-url": "^2.8.0",
    "@parcel/transformer-webmanifest": "^2.8.0",
    "parcel": "^2.8.0",
    "process": "^0.11.10"
  },
  "dependencies": {
    "three": "^0.146.0"
  }
}

馃 Expected Behavior

The TWEEN object should be present.

馃槸 Current Behavior

The TWEEN object is undefined.

馃拋 Possible Solution

馃敠 Context

馃捇 Code Sample

Steps to reproduce:

  1. Unzip test.zip
  2. npm install three
  3. yarn parcel test.html

馃實 Your Environment

Software Version(s)
Parcel 2.8.0
Node 16.14.2
npm/Yarn yarn 1.22.17
Operating System Windows 10 (using Git Bash)
@mischnic
Copy link
Member

Reproduction:

// a.js
import { TWEEN } from "./b.js";
console.log(TWEEN);

// b.js
var TWEEN = "something";
(function (t) {
	if ("undefined" != typeof module && "object" == typeof exports) {
		module.exports = TWEEN; // Parcel takes this branch
	} else if (t !== undefined) {
		t.TWEEN = TWEEN;
	}
})(this);
export { TWEEN };

But there's really not a lot we can do here because of the combination of ESM and CJS in the same file.

@github-actions github-actions bot added the Stale Inactive issues label May 27, 2023
@mischnic mischnic removed the Stale Inactive issues label Jun 3, 2023
@parcel-bundler parcel-bundler deleted a comment from github-actions bot Jun 3, 2023
@mischnic mischnic added the Stale Ignore This issue is exempt from getting flagged as stale and autoremoved label Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃悰 Bug 馃悺 JS Codegen 馃尦 Scope Hoisting Stale Ignore This issue is exempt from getting flagged as stale and autoremoved
Projects
None yet
Development

No branches or pull requests

2 participants