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

Update to Webpack 2.2 #396

Merged
merged 37 commits into from
Mar 8, 2017
Merged

Conversation

julianvmodesto
Copy link
Contributor

@julianvmodesto julianvmodesto commented Feb 14, 2017

Issue

#393

work in progress

@julianvmodesto
Copy link
Contributor Author

julianvmodesto commented Feb 14, 2017

Running into eslint errors Parsing error: 'import' and 'export' may only appear at the top level in the starter kyt routes files.

Seems like System.import is gone as of v2.1.0-beta.28, so maybe eslint isn't parsing these ES2015 Loader import()s correctly?

EDIT:

Looks like babel-eslint might be a solution? Or code splitting in starter kyts is blocked until import() is in stage 4 and eslint implements.

@tizmagik
Copy link
Contributor

FWIW System.import() will still continue to work, it's just deprecated for now. It'll be removed in Webpack 3 I think they said

@julianvmodesto
Copy link
Contributor Author

Oops, yeah looks like I jumped the gun with replacing System.import(), @tizmagik! Reverting that

@@ -1,3 +1,4 @@
{
"presets": ["kyt-react"]
"presets": ["kyt-react"],
"plugins": ["syntax-dynamic-import"]
Copy link
Member

Choose a reason for hiding this comment

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

Do you think we should just add this plugin to our babel-preset-kyt-core? This seems like something kyt should support/recommend out of the box.

@delambo
Copy link
Member

delambo commented Feb 14, 2017

@julianvmodesto - I think we should keep your System.import changes. Can you try babel-eslint in our linter?

@tizmagik
Copy link
Contributor

Yea agreed, it would be nice to upgrade to the new import() syntax, if possible.

@julianvmodesto
Copy link
Contributor Author

Sure thing, I'll make these changes –

  • move babel-plugin-syntax-dynamic-import to babel-preset-kyt-core's devDeps
  • try out babel-eslint in babel-preset-kyt-core

@julianvmodesto
Copy link
Contributor Author

julianvmodesto commented Feb 15, 2017

Seems that the Travis build failed since bootstrap.js was expecting yarn 0.19.0 but instead the latest yarn version 0.20.3 was installed.

0.20.3
❌  update your version of yarn: npm i yarn@^0.19.0 -g

Not sure how Travis works, but I think we want in the build script:

curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.19.0

EDIT:
Travis takes care of Yarn for us, so instead we want an update to bootstrap.js for yarn >=0.19.0: #400

@@ -1,15 +1,26 @@
var babelPresetLatest = require('babel-preset-latest');
var babelTransformRuntime = require('babel-plugin-transform-runtime');
var babelTransformModules = require('babel-plugin-transform-es2015-modules-commonjs');
var babelSyntaxDynamicImport = require('babel-plugin-syntax-dynamic-import');
var babelEslint = require('babel-eslint');
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'm trying to add babel-eslint here in packages/babel-preset-kyt-core, but kyt itself is linted with packages/eslint-config-kyt – so I'm guessing I have to add babel-eslint and babel-plugin-syntax-dynamic-import to eslint-config-kyt as well.

@julianvmodesto
Copy link
Contributor Author

julianvmodesto commented Feb 17, 2017

Ok, looks like we're good on the System.import to import() change and babel-eslint is working correctly - thanks Matt!

Currently troubleshooting an error with the webpackCompiler:


$ kyt dev 
ℹ️  Using kyt config at /home/travis/build/NYTimes/kyt/cli-test/kyt.config.js
🔥  Starting development build...
👍  Cleaned ./build
❌  Client webpack config is invalid
TypeError: arguments[i].apply is not a function
    at Compiler.apply (/home/travis/build/NYTimes/kyt/cli-test/node_modules/tapable/lib/Tapable.js:306:16)
    at webpack (/home/travis/build/NYTimes/kyt/cli-test/node_modules/webpack/lib/webpack.js:32:19)
    at module.exports.error (/home/travis/build/NYTimes/kyt/cli-test/node_modules/kyt/utils/webpackCompiler.js:10:23)
    at module.exports (/home/travis/build/NYTimes/kyt/cli-test/node_modules/kyt/cli/actions/dev.js:68:20)
    at loadConfigAndDo (/home/travis/build/NYTimes/kyt/cli-test/node_modules/kyt/cli/commands.js:34:3)
    at Command.program.command.option.description.action (/home/travis/build/NYTimes/kyt/cli-test/node_modules/kyt/cli/commands.js:49:5)
    at Command.listener (/home/travis/build/NYTimes/kyt/cli-test/node_modules/commander/index.js:301:8)
    at emitTwo (events.js:106:13)
    at Command.emit (events.js:191:7)
    at Command.parseArgs (/home/travis/build/NYTimes/kyt/cli-test/node_modules/commander/index.js:615:12)

I tried checking out what Tapable is doing, and it's running apply from the plugin prototype, but none of the plugins have this apply method in their prototype.

Googling around for this error and lewie9021/webpack-configurator#2 seems a little insightful – I'm putting some console.log statements in Tapable to see what's happening. Will update as I go along. If anyone has ideas, please let me know! Maybe there's some Webpack 2.2 change that I'm missing.

@delambo delambo changed the title Update to Webpack 2.2 [WIP] Update to Webpack 2.2 Feb 23, 2017
@delambo
Copy link
Member

delambo commented Feb 23, 2017

@julianvmodesto - ci test is passing again! I think we should merge #405 before this pull request so that we can run some of the new functional tests against the new webpack and loaders.

What do you think is left to do here?

@delambo
Copy link
Member

delambo commented Feb 23, 2017

@julianvmodesto - I got the new functional tests merged in. Looks good 👍

@julianvmodesto
Copy link
Contributor Author

Ah great! I don't have anything else to add I think. Merge onwards?

@delambo delambo changed the title [WIP] Update to Webpack 2.2 Update to Webpack 2.2 Feb 25, 2017
@delambo
Copy link
Member

delambo commented Feb 25, 2017

@jaredmcdonald @ccpricenytimes @tizmagik - Does anyone want to take a look at this? I tested it against our internal app. Looks good.

Copy link
Contributor

@ccpricenytimes ccpricenytimes left a comment

Choose a reason for hiding this comment

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

This is blocked by #399

Copy link
Contributor

@tizmagik tizmagik left a comment

Choose a reason for hiding this comment

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

This is awesome!! 👏

@jaredpalmer
Copy link

What is the status of this?

@julianvmodesto
Copy link
Contributor Author

Currently blocked by #399, but otherwise all set

@delambo delambo merged commit 57c38d7 into nytimes:master Mar 8, 2017
@delambo
Copy link
Member

delambo commented Mar 8, 2017

Thank you @julianvmodesto 🙏

@julianvmodesto julianvmodesto deleted the update-webpack-2.2 branch March 8, 2017 23:11
tizmagik added a commit that referenced this pull request Mar 9, 2017
* master:
  Upgrade stylelint (#417)
  Update to Webpack 2.2 (#396)
  Version and install starter-kyts with npm (#425)
  adds prep for 0.4.1 (#428)
  fixes static public path for noServer configuration (#427)
  Adds local-path argument for testing local starter-kyt setup (#403)

# Conflicts:
#	packages/kyt-core/package.json
#	packages/kyt-core/yarn.lock
#	packages/kyt-starter-static/starter-src/yarn.lock
#	packages/kyt-starter-universal/starter-src/src/yarn.lock
#	yarn.lock
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.

None yet

5 participants