plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

[BUG] 🔴 ERROR | Failed to resolve '../../popup.tsx' from './.plasmo/static/popup.tsx'

Open ti-bui opened this issue 1 year ago • 14 comments

What happened?

When I run npm run build, I am receiving this error: 🔴 ERROR | Failed to resolve '../../popup.tsx' from './.plasmo/static/popup.tsx'

The file path is correct, I have my popup.tsx in the root and here's what in popup.tsx.:

import { useReducer } from 'react';

import './style.css';

export default function IndexPopup() {
  const [count, increase] = useReducer((c) => c + 1, 0);

  return (
    <button
      onClick={() => increase()}
      type="button"
      className="inline-flex items-center px-5 py-2.5 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
    >
      Hello World
      <br />
      Count:
      <span className="inline-flex items-center justify-center w-8 h-4 ml-2 text-xs font-semibold text-blue-800 bg-blue-200 rounded-full">
        {count}
      </span>
    </button>
  );
}

I have no problem with the dev build but this error raises for production. I would greatly appreciate any insights on this matter. Thanks!

Version

Latest

What OS are you seeing the problem on?

MacOSX

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contribution

  • [ ] I would like to fix this BUG via a PR

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I checked the current issues for duplicate problems.

ti-bui avatar Jul 30 '24 22:07 ti-bui

Great question and thanking for putting it forward! I encountered the same issue... Hope someone knows how to resolve this.

chok-di avatar Jul 31 '24 20:07 chok-di

I was using node version 22.1.6 and experiencing this issue. After changing the node version to 18.20, the problem no longer occurred!

kecan0406 avatar Sep 15 '24 08:09 kecan0406

use v20.3.1 and face the same issue

AkoWu101 avatar Oct 17 '24 15:10 AkoWu101

same issue use v20.18.0

dodola avatar Oct 29 '24 10:10 dodola

I was using node version 22.1.6 and experiencing this issue. After changing the node version to 18.20, the problem no longer occurred!

same error in node v18.20

dadede999 avatar Nov 06 '24 06:11 dadede999

I'm here for the same reason: the dev build works, but the prod build won't compile. I tried versions from 18 to 20, but it didn't work.

lorof avatar Nov 15 '24 19:11 lorof

We're seeing this as well - node 22.11 here. Is this consistently reproducible using any set of options?

jonluca avatar Nov 23 '24 00:11 jonluca

Same issue. Has anyone solved this problem?

Rrrrnnyg avatar Dec 09 '24 11:12 Rrrrnnyg

Same issue. Has anyone solved this problem?

I solved it by creating a new project, moving all code, and installing the packages one by one.

lorof avatar Dec 09 '24 16:12 lorof

I remove "engines": { "node": ">=18" } in package.json, solved this error

fangmd avatar Dec 10 '24 09:12 fangmd

I remove "engines": { "node": ">=18" } in package.json, solved this error

YES!Thank you!

Rrrrnnyg avatar Dec 11 '24 04:12 Rrrrnnyg

Probably your "main" is populated, remove that from package.json it will be fixed.

tuhinpal avatar Apr 03 '25 14:04 tuhinpal

Getting this too! here's an example repo, fixed by remoing the engines from package.json as @fangmd suggested (Thanks!)

Acorn221 avatar Jun 18 '25 11:06 Acorn221

How to solve this problem?

liyunfei22 avatar Jul 28 '25 07:07 liyunfei22