Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.

move to webpack-dev-server; separate webpack configs; add html-webpack-plugin#39

Open
DSchau wants to merge 1 commit intoFormidableLabs:masterfrom
DSchau:boilerplate-tweaks
Open

move to webpack-dev-server; separate webpack configs; add html-webpack-plugin#39
DSchau wants to merge 1 commit intoFormidableLabs:masterfrom
DSchau:boilerplate-tweaks

Conversation

@DSchau
Copy link

@DSchau DSchau commented May 2, 2017

Hello!

I found that this boilerplate is great (as is spectacle), but there are some simple tweaks I think we could make to possibly move to more of a standard config

As such, I made a bunch of them. Here's a high level list, and I'll try and go through and add comments to the files when appropriate.

  • Adding webpack-dev-server
  • Moving dev/prod functionality into separate files for webpack config
  • Add html-webpack-plugin to automatically inject scripts
  • Build into dist, and only use dist/ directory for surge (rather than entire directory)

Please let me know if there's anything else I can do to help out/improve this PR.

Long-term, I'd love to get a fork of create-react-app working that supports markdown (and other necessary functionality of spectacle) and just use that, but I still think there's value in these changes.

Thanks!

- Adding webpack-dev-server
- Moving dev/prod functionality into separate files for webpack config
- Add html-webpack-plugin to automatically inject scripts
"deploy": "npm run clean & npm run build && surge -p .",
"start": "cross-env NODE_ENV=development node server.js"
"deploy": "npm run clean & npm run build && surge -p dist",
"start": "cross-env NODE_ENV=development webpack-dev-server --hot --port 3000 --content-base dist --config webpack.config.development.js"
Copy link
Author

Choose a reason for hiding this comment

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

Self-explanatory, but swap out the custom express server and just use webpack dev server. Hot reloading and everything (to the best of my knowledge/testing) still works!

"surge": "latest",
"url-loader": "^0.5.6",
"webpack": "2.2.0",
"webpack": "~2.4.1",
Copy link
Author

Choose a reason for hiding this comment

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

Bumped the webpack version

@@ -0,0 +1,43 @@
/* eslint-disable */

Copy link
Author

Choose a reason for hiding this comment

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

We could improve this whole file by switching to webpack-merge or the like, but didn't want to get too crazy off of the bat

test: /\.gif$/,
loader: "url-loader?mimetype=image/gif",
include: path.join(__dirname, "assets")
test: /\.(png|jpe?g|gif)$/,
Copy link
Author

Choose a reason for hiding this comment

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

Merged these loaders, not sure if the mimetype was doing a whole bunch. If so, I'll switch it back!

@DSchau DSchau changed the title various tweaks to the boilerplate move to webpack-dev-server; separate webpack configs; add html-webpack-plugin May 2, 2017
new webpack.NoEmitOnErrorsPlugin()
]);

config.module.rules[0] = {
Copy link
Author

Choose a reason for hiding this comment

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

Don't like that this requires the first item to always be the js|jsx loader. Open to other approaches...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant