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

[WIP] Experimental use webpack #1997

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

kounoike
Copy link
Contributor

@kounoike kounoike commented May 6, 2018

I tried to introduce webpack. This PR contains the result.

advantage to current implementation

  • resource bundling

Now, many resources are included from every page. Webpack can bundle these resources.

before:
20180505-161911

after:
20180505-162116

Of cource, these resources are cached by browser normally.

  • minification

In webpack and sbt-webpack, minify js/css is simply done by webpack prod on sbt.

advantage to Webjars (#1595)

  • Webjars is hard-tied to sbt and node.js

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.

  • management library

webpack uses simple npm's package.json. It can use GitHub's repo directory. So, we can manage our customized jsdifflib as gitbucket/jsdifflib.

  • simplicity

If we needs new javascript library, adding it is very easy. npm install --save and require('library'); to main.js.

disadvantage

  • need node.js/npm install for developer

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.

@nazoking
Copy link
Member

nazoking commented May 7, 2018

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
Copy link
Member

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,

@aadrian
Copy link
Member

aadrian commented Jun 23, 2018

As discussed here #1430 too, webpack is the better solution.

@zexxar
Copy link

zexxar commented Jun 25, 2018

I also think that webpack is the better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

4 participants