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

Setup with additional webextension-toolbox.config.js config seems to fail on windows 11 #656

Open
JaroslawPokropinski opened this issue Oct 5, 2022 · 10 comments · Fixed by #832
Labels
Edge/Windows Issues related to Edge or Windows on hold Not working on it

Comments

@JaroslawPokropinski
Copy link

JaroslawPokropinski commented Oct 5, 2022

Expected Behavior

Running dev/build does not throw Error: Cannot find module error.

Current Behavior

Running webextension-toolbox build -s src --no-manifest-validation "chrome" throws:

Error: Cannot find module 'file:///E:\Programming\Projects\fast-downloader-web-extension\webextension-toolbox.config.js'
Require stack:
- E:\Programming\Projects\fast-downloader-web-extension\node_modules\@webextension-toolbox\webextension-toolbox\dist\common\compile.js
- E:\Programming\Projects\fast-downloader-web-extension\node_modules\@webextension-toolbox\webextension-toolbox\dist\build.js
- E:\Programming\Projects\fast-downloader-web-extension\node_modules\@webextension-toolbox\webextension-toolbox\dist\index.js
- E:\Programming\Projects\fast-downloader-web-extension\node_modules\@webextension-toolbox\webextension-toolbox\dist\command.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at E:\Programming\Projects\fast-downloader-web-extension\node_modules\@webextension-toolbox\webextension-toolbox\dist\common\compile.js:41:78
    at async getConfigFile (E:\Programming\Projects\fast-downloader-web-extension\node_modules\@webextension-toolbox\webextension-toolbox\dist\common\compile.js:41:30)
    at async exports.default (E:\Programming\Projects\fast-downloader-web-extension\node_modules\@webextension-toolbox\webextension-toolbox\dist\common\compile.js:53:36)
    at async Command.dev (E:\Programming\Projects\fast-downloader-web-extension\node_modules\@webextension-toolbox\webextension-toolbox\dist\dev.js:12:22) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'E:\\Programming\\Projects\\fast-downloader-web-extension\\node_modules\\@webextension-toolbox\\webextension-toolbox\\dist\\common\\compile.js',
    'E:\\Programming\\Projects\\fast-downloader-web-extension\\node_modules\\@webextension-toolbox\\webextension-toolbox\\dist\\build.js',
    'E:\\Programming\\Projects\\fast-downloader-web-extension\\node_modules\\@webextension-toolbox\\webextension-toolbox\\dist\\index.js',
    'E:\\Programming\\Projects\\fast-downloader-web-extension\\node_modules\\@webextension-toolbox\\webextension-toolbox\\dist\\command.js'
  ]
}

Steps to Reproduce (for bugs)

  1. Create webextension-toolbox.config.js configuration file
  2. Run npm run dev chrome

Context

Running build with additional webpack configuration seems to fail on windows 11.
When i remove

if (process.platform === "win32") {
            path = `file:///${path}`;
        }

from compile.js it succeeds.

For context I use react, typescript setup and manifest v3 but I don't think that it affects the behavior.

Your Environment

Tech Version
webextension-toolbox 5.2.2
node v16.17.0
OS Windows 11
browser chrome
etc
@tm1000
Copy link
Member

tm1000 commented Oct 19, 2022

The reason for the code you removed was so that it worked in github actions on their windows builder.

@tm1000 tm1000 added the question Further information is requested label Nov 8, 2022
@stale
Copy link

stale bot commented Jan 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@jinwook-k
Copy link

for mitigation for other people, you can remove this portion of highlighted code in your node_modules to be able to build successfully in windows 11

I will try to help and try to submit a PR on trying to fix this issue.

image

@tm1000 tm1000 added Edge/Windows Issues related to Edge or Windows on hold Not working on it and removed question Further information is requested wontfix This will not be worked on labels Feb 25, 2023
@tm1000 tm1000 reopened this Feb 25, 2023
@stale
Copy link

stale bot commented Apr 26, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 26, 2023
@stale stale bot closed this as completed May 3, 2023
@here-nerd
Copy link
Contributor

for mitigation for other people, you can remove this portion of highlighted code in your node_modules to be able to build successfully in windows 11

I will try to help and try to submit a PR on trying to fix this issue.

image

@JinKim7 is there any update on the issue?
Is it a good idea to add a CLI configuration for a github actions build vs a windows build?

@tm1000
Copy link
Member

tm1000 commented Oct 30, 2023

@here-nerd Whatever works! I'm all for it if we need a work around in github for windows

@tm1000 tm1000 reopened this Oct 30, 2023
@stale stale bot removed the wontfix This will not be worked on label Oct 30, 2023
@tm1000 tm1000 linked a pull request Nov 25, 2023 that will close this issue
Copy link

stale bot commented Dec 30, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 30, 2023
@stale stale bot closed this as completed Jan 6, 2024
@tm1000
Copy link
Member

tm1000 commented Jan 8, 2024

Resolved in #832

@juharris
Copy link

I'm getting a similar error in with "@webextension-toolbox/webextension-toolbox" version "7.1.1" with Git Bash in Windows.

$ npx webextension-toolbox dev chrome --config webextension-toolbox.config.js
✔ Loading webpack config from C:\Users\Justin\workspace\onhello\webextension-toolbox.config.js
node:internal/modules/esm/load:239
    throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, schemes);
          ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:239:11)
    at defaultLoad (node:internal/modules/esm/load:130:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:409:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:56)
    at new ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:303:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:241:17)
    at async ModuleLoader.import (node:internal/modules/esm/loader:328:23) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Node.js v20.11.1

In node_modules@webextension-toolbox\webextension-toolbox\dist\common\compile.js, I changed:

const configModule = await import(path);

to

const configModule = await import(`file://${path}`);

and it worked for me.

I tried many ways and combinations to input the path differently for the --config argument with a more full path and I don't think it makes a difference.

@tm1000 tm1000 reopened this Feb 27, 2024
@stale stale bot removed the wontfix This will not be worked on label Feb 27, 2024
Copy link

stale bot commented Apr 27, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 27, 2024
@stale stale bot closed this as completed May 4, 2024
@tm1000 tm1000 removed the wontfix This will not be worked on label May 5, 2024
@tm1000 tm1000 reopened this May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Edge/Windows Issues related to Edge or Windows on hold Not working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants