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

Fix: npx webpack make: *** [Makefile:699: public/js/index.js] Error -… #15465

Merged
merged 3 commits into from
Apr 15, 2021

Conversation

Run2948
Copy link
Contributor

@Run2948 Run2948 commented Apr 14, 2021

when I execute TAGS="bindata" make build to build gitea, it shows:
npx webpack make: *** [Makefile:699: public/js/index.js] Error -1073741819

$ webpack -v
webpack 5.11.1
webpack-cli 4.3.1

$ TAGS="bindata" make build
rm -rf public/js public/css public/fonts public/img/webpack public/serviceworker.js
npx webpack
[webpack-cli] Failed to load 'E:\C_Language\Workspaces\GoProjects\gitea\webpack.config.js' config
[webpack-cli] file:///E:/C_Language/Workspaces/GoProjects/gitea/webpack.config.js:9
import {VueLoaderPlugin} from 'vue-loader';
        ^^^^^^^^^^^^^^^
SyntaxError: The requested module 'vue-loader' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'vue-loader';
const {VueLoaderPlugin} = pkg;
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:98:21)
    at async ModuleJob.run (internal/modules/esm/module_job.js:137:5)
    at async Loader.import (internal/modules/esm/loader.js:165:24)
    at async loadConfig (E:\C_Language\Workspaces\GoProjects\gitea\node_modules\webpack-cli\lib\webpack-cli.js:1346:35)
    at async WebpackCLI.resolveConfig (E:\C_Language\Workspaces\GoProjects\gitea\node_modules\webpack-cli\lib\webpack-cli.js:1454:38)
    at async WebpackCLI.createCompiler (E:\C_Language\Workspaces\GoProjects\gitea\node_modules\webpack-cli\lib\webpack-cli.js:1839:22)
    at async WebpackCLI.buildCommand (E:\C_Language\Workspaces\GoProjects\gitea\node_modules\webpack-cli\lib\webpack-cli.js:1954:20)
    at async Command.<anonymous> (E:\C_Language\Workspaces\GoProjects\gitea\node_modules\webpack-cli\lib\webpack-cli.js:735:25)
    at async Promise.all (index 1)
    at async Command.<anonymous> (E:\C_Language\Workspaces\GoProjects\gitea\node_modules\webpack-cli\lib\webpack-cli.js:1284:13)
make: *** [Makefile:699: public/js/index.js] Error 2

@silverwind
Copy link
Member

silverwind commented Apr 14, 2021

Ah, this could be a issue with Node's ESM resolution. Wich node version were you encountering this? Perhaps 12? Because I think I only tested this on 14 and 15.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 14, 2021
webpack.config.js Outdated Show resolved Hide resolved
@jolheiser
Copy link
Member

fwiw I ran into this exact error yesterday.
I was using node 12.18, updating to 12.22 resolved the error for whatever reason.

If this fix is more permanent, that's great. 🙂

@silverwind
Copy link
Member

silverwind commented Apr 14, 2021

@jolheiser good to know. Our minimum Node version is 12.17.0 so we should either require the higher version that fixed these resolutions or make them compatible with 12.17.0. I will check later if we have other code that would need such treatment as well.

@silverwind
Copy link
Member

Looks like 12.20 is the version with the fix:

https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V12.md#2020-11-24-version-12200-erbium-lts-mylesborins

(SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) nodejs/node#35249

@silverwind
Copy link
Member

silverwind commented Apr 14, 2021

I think we can go with this fix for broader node compatibilty. Happy to approve after the suggestion above is merged. I see that build scripts suffer a similar issue under node 12, will send a PR for those as well.

@silverwind
Copy link
Member

Can someone with push rights merge above suggestion so I can approve? :)

Co-authored-by: silverwind <[email protected]>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 15, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 15, 2021
@zeripath zeripath added the topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile label Apr 15, 2021
@zeripath zeripath added this to the 1.15.0 milestone Apr 15, 2021
@zeripath
Copy link
Contributor

does this need backporting?

@silverwind
Copy link
Member

no, esm is only on master.

@techknowlogick
Copy link
Member

🚀

@techknowlogick techknowlogick merged commit 953f398 into go-gitea:master Apr 15, 2021
@Run2948 Run2948 deleted the master branch May 11, 2021 09:17
@go-gitea go-gitea locked and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants