Skip to content

[WIP] Experimental use webpack - #1997

Open
kounoike wants to merge 8 commits into
gitbucket:masterfrom
kounoike:pr-webpack
Open

kounoike wants to merge 8 commits into
gitbucket:masterfrom
kounoike:pr-webpack

Conversation

@kounoike

@kounoike kounoike commented May 6, 2018

Copy link
Copy Markdown
Contributor

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

nazoking commented May 7, 2018

Copy link
Copy Markdown
Member

I changed my mind. I think webpack is a good solution for gitbucket. More than webjars.

Comment thread .gitignore Outdated
.idea/
.idea_modules/
*.iml
/package-lock.json

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

aadrian commented Jun 23, 2018

Copy link
Copy Markdown
Member

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

@zexxar

zexxar commented Jun 25, 2018

Copy link
Copy Markdown

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.

4 participants