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
[WIP] Experimental use webpack #1997
base: master
Are you sure you want to change the base?
Conversation
I changed my mind. I think webpack is a good solution for gitbucket. More than webjars. |
.gitignore
Outdated
@@ -24,3 +24,6 @@ project/plugins/project/ | |||
.idea/ | |||
.idea_modules/ | |||
*.iml | |||
/package-lock.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.npmjs.com/files/package-lock.json
This file is intended to be committed into source repositories,
As discussed here #1430 too, webpack is the better solution. |
I also think that webpack is the better solution. |
I tried to introduce webpack. This PR contains the result.
advantage to current implementation
Now, many resources are included from every page. Webpack can bundle these resources.
before:
after:
Of cource, these resources are cached by browser normally.
In webpack and sbt-webpack, minify js/css is simply done by
webpack prod
on sbt.advantage to Webjars (#1595)
Rather, I think that it is appropriate to say that "Webjars is overkill". It imports npm dependency to jars one, so more lines required to write in build.sbt.
Webjars also has more complicated dependency by webjars classic/npm/bower jars. At least I know, trouble will occur when using mixed them.
webpack uses simple npm's
package.json
. It can use GitHub's repo directory. So, we can manage our customizedjsdifflib
as gitbucket/jsdifflib.If we needs new javascript library, adding it is very easy.
npm install --save
andrequire('library');
tomain.js
.disadvantage
User doesn't need node/npm. Simply run
java -jar gitbucket.war
. But for building GitBucket,npm install
downloads node_modules and sbt-webpack requires node.js.TODOs
I didn't check all functionality behavior. At least, diff doesn't work yet. It is required to do modulerize our javascript files.