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

Upgrade to Webpack 4 #1214

Merged
merged 21 commits into from
May 15, 2018
Merged

Upgrade to Webpack 4 #1214

merged 21 commits into from
May 15, 2018

Conversation

tech4him1
Copy link
Contributor

@tech4him1 tech4him1 commented Mar 29, 2018

- Summary
Changed Plugins:

  • extract-text-webpack-plugin
  • webpack-postcss-tools
    • do we even use it anymore?
    • removed
  • write-file-webpack-plugin + webpack-dev-server
    • migrated to webpack-serve (unstable for function configs)
    • dropped historyApiFallback option -- not needed
    • dropped disableHostCheck option -- doesn't seem necessary?
    • dropped Access-Control header -- doesn't seem necessary?
  • react-hot-loader
  • webpack-merge
    • configs combined, removed

Working Plugins:

  • babel-loader
  • css-loader
  • exports-loader
  • file-loader
  • imports-loader
  • postcss-loader
  • style-loader
  • svg-inline-loader

- Test plan

Build commands to test:

  • dev (and testing RHL)
  • dev:write
  • test
  • build
  • build:scripts (removed)
    • Broken since we upgraded to WebPack v3.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@verythorough
Copy link
Contributor

verythorough commented Mar 29, 2018

Deploy preview for netlify-cms-www ready!

Built with commit 70b7fc3

https://deploy-preview-1214--netlify-cms-www.netlify.com

@verythorough
Copy link
Contributor

verythorough commented Mar 29, 2018

Deploy preview for cms-demo ready!

Built with commit 70b7fc3

https://deploy-preview-1214--cms-demo.netlify.com

@tech4him1 tech4him1 force-pushed the webpack-4 branch 3 times, most recently from 85a7aa4 to 5455845 Compare March 31, 2018 14:51
@tech4him1 tech4him1 changed the title WIP: Upgrade to Webpack 4 Upgrade to Webpack 4 Apr 4, 2018
@tech4him1
Copy link
Contributor Author

tech4him1 commented Apr 13, 2018

Ready for review!

Tests needed (check em' off):

  • dev (and testing RHL)
    • Windows
    • Mac
    • Linux
  • dev:write
  • test
  • build
    • Using script tag.
    • Using manual CMS init.
  • build:scripts

Copy link
Collaborator

@talves talves left a comment

Choose a reason for hiding this comment

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

Everything else looked pretty good

webpack.dev.js Outdated
library: 'netlify-cms',
libraryTarget: 'umd',
umdNamedDefine: true,
},
context: path.join(__dirname, 'src'),
module: {
noParse: /localforage\.js/,
loaders: [
rules: [
{
loader: path.resolve(__dirname, './node_modules/babel-loader'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line does not resolve for me. Used:

loader: 'babel-loader',

reason I was testing against hoisting dependencies using yarn workspaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have you tested using WebPack v3? Looking at the git blame, I think there was a reason it was set explicitly like this.

Copy link
Collaborator

@talves talves Apr 21, 2018

Choose a reason for hiding this comment

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

Just tested it and the yarn start worked without an issue. I would not know what issue would be caused by that, because it is just a loader. I sure creates an issue if you are hoisting dependencies for yarn workspaces though 👅

Copy link
Contributor Author

@tech4him1 tech4him1 Apr 22, 2018

Choose a reason for hiding this comment

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

@erquhart Can you provide background on why this is necessary (#446)?

webpack.prod.js Outdated
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.DefinePlugin({
NETLIFY_CMS_VERSION: JSON.stringify(require("./package.json").version),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This dangling require has always bugged me 😀
There is one in webpack.dev.js also

const packageData = require("./package.json");

then

NETLIFY_CMS_VERSION: JSON.stringify(packageData.version),

webpack.dev.js to:

NETLIFY_CMS_VERSION: JSON.stringify(`${ packageData.version }-dev`),

webpack.dev.js Outdated
devServer: {
contentBase: 'example/',
historyApiFallback: true,
disableHostCheck: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dropped historyApiFallback and disableHostCheck, is there a reason they were needed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I added them back on the PR to this branch just submitted, we should test to see if we can get rid of them

@talves talves changed the title Upgrade to Webpack 4 (WIP) Upgrade to Webpack 4 Apr 24, 2018
@talves
Copy link
Collaborator

talves commented Apr 24, 2018

Caleb, I changed this to WIP just as a reminder there is a PR #1313 against this branch, so you don't forget to merge it if you so choose. 😀

  • Reverted back to webpack-dev-server, but it was more compatible with the setup.
  • Removed the unused script per a discussion with @erquhart
  • Removed webpack-merge

@talves talves changed the title (WIP) Upgrade to Webpack 4 Upgrade to Webpack 4 Apr 24, 2018
@talves
Copy link
Collaborator

talves commented Apr 24, 2018

@tech4him1 @Benaiah @erquhart Merged in the single webpack.config.js changes and ready to test this extensively.

@erquhart
Copy link
Contributor

@tech4him1 the only tests remaining are Windows and Linux. @talves are you on Windows? @Benaiah can you run a quick build on Linux?

@talves
Copy link
Collaborator

talves commented May 15, 2018

I already approved for Windows. Did not keep my check mark 😛. I have been building using this branch for weeks since I made the merged changes.

@erquhart
Copy link
Contributor

Alright, I think Linux is probably okay right? Those guys like living on the edge anyway...

@erquhart erquhart merged commit 4d981d8 into master May 15, 2018
@erquhart erquhart deleted the webpack-4 branch May 15, 2018 22:38
brianlmacdonald pushed a commit to brianlmacdonald/netlify-cms that referenced this pull request May 23, 2018
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.

Re-implement React Hot Loader
4 participants