PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.63k stars 369 forks source link

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

Open ti-bui opened 3 months ago

ti-bui commented 3 months ago

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

Code of Conduct

chok-di commented 3 months ago

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

kecan0406 commented 2 months ago

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!

KingWu commented 1 month ago

use v20.3.1 and face the same issue

dodola commented 4 weeks ago

same issue use v20.18.0

dadede999 commented 2 weeks ago

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

lorof commented 1 week ago

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.

jonluca commented 3 days ago

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