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

Adding Webpack Dev Server #22

Closed
wants to merge 28 commits into from
Closed

Adding Webpack Dev Server #22

wants to merge 28 commits into from

Conversation

hutchgrant
Copy link
Member

@hutchgrant hutchgrant commented Mar 27, 2019

Resolves #14

Adds

  • webpack dev server
  • nodemon
  • concurrently

Changes

  • if node_env is development, then the final steps of our the cli/index.js will not be run (serializing components and publishing to public folder).

Problems:

  • this will monitor js/css/html/md changes, however, I'm not positive if it will monitor the user's source directory.
  • it will display a brief compilation error on every change update, due to the gap between rebuilding the scratch directory and the webpack-dev-server recompiling and serving the files.

@hutchgrant hutchgrant changed the title task: adding webpack dev server Adding Webpack Dev Server Mar 27, 2019
Copy link
Member

@thescientist13 thescientist13 left a comment

Choose a reason for hiding this comment

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

Thanks for this!

Let's see what comes out of our discussion of #28 , and see if that influences our direction on this feature.

@thescientist13 thescientist13 added the enhancement Improve something existing (e.g. no docs, new APIs, etc) label Mar 30, 2019
@hutchgrant
Copy link
Member Author

hutchgrant commented Apr 2, 2019

When tested with the rfc-user-workspace branch merged, the scaffold script fixed to prevent creating directories that already exist, as well as not cleaning on every build, the nodemon + webpack-dev-server script runs smoothly!

Copy link
Member

@thescientist13 thescientist13 left a comment

Choose a reason for hiding this comment

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

Nice, this looks like a promising start!

Main concern with this approach as it stands currently is that it is happening entirely within npm / Yarn scripts, when it should really be happening within index.js.

From a user's perspective, as they will be running greenwood from the CLI, for a feature like this, I would expect the API to be something like:

$ greenwood --[build|develop]

From within that, I would expect Greenwood to launch with the appropriate processes, eg.

  • build: webpack
  • develop: webpack-dev-server and whatever else we need to get it to work

As far as the project goes, we can still use an npm script, but it would be similar to the build task, e.g.

$ node ./packages/cli/index.js --develop

From there, I would be interested to see if we can somehow define an additional entry point or watch capabilities from webpack itself? Maybe some sort of directory watching or webpack.config.develop.js specific entry point that can point to a user's src/ directory? 🤔

Some things I found that might be of help here

@thescientist13
Copy link
Member

Closing this since #36 is pretty much good to go at this point. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve something existing (e.g. no docs, new APIs, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a user I should have a development mode to facilitate local development
2 participants