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

CB-349: Gulp to webpack #253

Merged
merged 18 commits into from
Aug 3, 2020
Merged

Conversation

bimalkant-lauhny
Copy link
Contributor

Summary of changes:

  • Updated package.json with packages to support Webpack, replaced npm-shrinkwrap.json with package-lock.json.
  • Removed gulp and added webpack. Added plugins to convert less to css, clean build directory and generate manifest file.
  • Updated static_manager.py to read from newer manifest file.
  • Updated .babelrc with newer babel env.
  • Updated node to version 10.x in Dockerfile. Also updated command to build scripts and styles.

Copy link
Member

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job moving the project over to webpack !

I wasn't able to see it in action using the docker-compose -f docker/docker-compose.dev.yml up -d command.
Looking at the Dockerfile.dev it doesn't look like you're runnin npm run build anywhere.
The CB docs talk about running a command in a new container, which seems a bit cumbersome.
Do you know what the reason is not to compile the static assets on build in dev environment, or is that a question for @alastair ?

webpack.config.js Outdated Show resolved Hide resolved
webpack.config.js Outdated Show resolved Hide resolved
webpack.config.js Outdated Show resolved Hide resolved
@alastair
Copy link
Collaborator

alastair commented Mar 21, 2019

Do you know what the reason is not to compile the static assets on build in dev environment

We can't do this during development because we mount the working directory into the web container as a volume, and this overrides any commands that we run during build. This is the same way that we do static assets for build in AB

@MonkeyDo
Copy link
Member

OK, thanks @alastair . Personally I don't mind running npm commands on my machine.

@bimalkant-lauhny
Copy link
Contributor Author

@MonkeyDo Thanks for suggesting improvements. I've made the changes.

@MonkeyDo
Copy link
Member

Look good, nice job !

@bimalkant-lauhny bimalkant-lauhny changed the title CB-349: Gulp to webpack [WIP] CB-349: Gulp to webpack Mar 24, 2019
@bimalkant-lauhny bimalkant-lauhny changed the title [WIP] CB-349: Gulp to webpack CB-349: Gulp to webpack Mar 25, 2019
@bimalkant-lauhny
Copy link
Contributor Author

New changes:

  • downgrade jquery to version 2.2.4 to support andSelf function for bootstrap-rating-input. [https://github.com/Cannot fetch latest changes via npm javiertoledo/bootstrap-rating-input#69](I opened an issue for this here.)
  • removed webpack-dev-server because it is unnecessary here. Any scripts and styles changes requires running command npm run build from docker container. May be we can add it's support later.
  • Removed unnecessary single chunk optimization. contenthash file names work as expected without this webpack configuration option.

@paramsingh
Copy link
Collaborator

In LB, We do live compiling by adding a seperate container that has webpack build --watch running inside and the static assets are moved out of the volume. I'd like a similar setup here.

@bimalkant-lauhny
Copy link
Contributor Author

@paramsingh please review now! I have added the changes.

Copy link
Member

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new setup doesn't seem to be working for me.
I get a 404 on js and css resources: GET http://localhost:8080/static/common.js net::ERR_ABORTED 404 This should be static/build/common.js, which loads correctly.

Issue with the static_manager or the manifest file, perhaps?

webpack.config.js Outdated Show resolved Hide resolved
@@ -0,0 +1,8 @@
FROM node:10.15-alpine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the builder have to be a separate docker image? Typically we try to share our images as much as possible. The Dockerfile for CB also performs npm install, so as far as I can tell we should be able to build the static files using a container based on that image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alastair Well, I just tried to take inspiration from the new setup in LB. 😅 @paramsingh @MonkeyDo what do you guys think about this?

Copy link
Member

@MonkeyDo MonkeyDo Apr 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alastair is absolutely right! If the CB docker image can run npm commands, then there's no need to use another image.

For LB, there was previously nothing using node so the image did not contain node.

@@ -1,4 +1,4 @@
#!/bin/sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this file used anywhere in this repository. Is it needed?

@MonkeyDo
Copy link
Member

@code-master5 : After discussing it with alastair, removing CleanWebpackPlugin and running the asset building once before starting the services does the trick (at least until a better solution is found). I've added some commits to document that.

@bimalkant-lauhny
Copy link
Contributor Author

@MonkeyDo @alastair Thanks for your guidance! I'm sorry I could not follow up more actively because of some personal stuff. 😅

@bimalkant-lauhny
Copy link
Contributor Author

@paramsingh @ferbncode please find some time to review and merge this (or suggest changes if any).

@bimalkant-lauhny
Copy link
Contributor Author

@ferbncode @paramsingh Any reasons for not reviewing or merging this PR?

@alastair alastair merged commit b35b7e1 into metabrainz:master Aug 3, 2020
@alastair
Copy link
Collaborator

alastair commented Aug 3, 2020

Thanks, merged into master!

@bimalkant-lauhny
Copy link
Contributor Author

Thanks @alastair ! 🙇

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

Successfully merging this pull request may close these issues.

4 participants