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

Parcel bundler not working for npm module library #8669

Open
ocodista opened this issue Dec 2, 2022 · 3 comments
Open

Parcel bundler not working for npm module library #8669

ocodista opened this issue Dec 2, 2022 · 3 comments

Comments

@ocodista
Copy link

ocodista commented Dec 2, 2022

馃悰 bug report

If I try to install a module pointing to a bundled file generated from parcel build it throws an error.

image

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

package.json

{
  "name": "parcel-package",
  "version": "1.0.0",
  "description": "Reproduction of parcel error",
  "source": "src/index.ts",
  "main": "dist/main.js",
  "module": "dist/module.js",
  "types": "dist/types.d.ts",
  "bin": {
    "parcel-package": "dist/main.js"
  },
  "scripts": {
    "build": "parcel build",
    "install-module": "npm i -g .",
    "test-module": "parcel-package"
  },
  "author": "Caio Borghi",
  "license": "ISC",
  "dependencies": {
    "chalk": "^5.1.2"
  },
  "devDependencies": {
    "@parcel/packager-ts": "2.8.0",
    "@parcel/transformer-typescript-types": "2.8.0",
    "parcel": "^2.8.0",
    "typescript": ">=3.0.0"
  }
}

馃 Expected Behavior

It should work after install

馃槸 Current Behavior

It's not working.

馃拋 Possible Solution

Understand why NPM cannot run the bundle and fix the issue.

馃敠 Context

I'm trying to build a npm module to publish on npm

馃捇 Code Sample

With this index file and the package.json you're already able to reproduce it.

src/index.ts

import chalk from "chalk"

console.log(chalk.green('This is a test application'))

Simply run:

npm run install-module

Then

npm run test-module

And you'll see the following error

image

馃實 Your Environment

Software Version(s)
Parcel ^2.8.0
Node 18.12.1
npm/Yarn 8.19.2
Operating System Arch linux WSL
@mischnic
Copy link
Member

mischnic commented Dec 2, 2022

Please provide a reproduction by filling out the issue template

@ocodista
Copy link
Author

ocodista commented Dec 2, 2022

Comment updated with src/index.ts file and package.json

@ocodista
Copy link
Author

ocodista commented Dec 3, 2022

Hey @mischnic were you able to check it?

@github-actions github-actions bot added the Stale Inactive issues label Jul 17, 2023
@mischnic mischnic removed the Stale Inactive issues label Jul 19, 2023
@parcel-bundler parcel-bundler deleted a comment from github-actions bot Jul 19, 2023
@github-actions github-actions bot added the Stale Inactive issues label Jan 15, 2024
@mischnic mischnic removed the Stale Inactive issues label Jan 15, 2024
@parcel-bundler parcel-bundler deleted a comment from github-actions bot Jan 15, 2024
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