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

Fix: switch over to webpack-dev-server #105

Closed
wants to merge 15 commits into from
Closed

Fix: switch over to webpack-dev-server #105

wants to merge 15 commits into from

Conversation

airtonix
Copy link

Fixes #104

@@ -52,7 +52,13 @@ const cli = meow(`
},
port: {
type: 'string',
alias: 'p'
alias: 'p',
default: '8080'
Copy link
Author

Choose a reason for hiding this comment

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

needed to supply these because i think webpack-serve was previously providing this default

@@ -145,8 +151,7 @@ switch (cmd) {
const dev = require('./lib/dev')
dev(opts)
.then(({ server }) => {
const { port } = server.options
const url = `http://localhost:${port}`
const url = `http://${server.host}:${server.port}`
Copy link
Author

Choose a reason for hiding this comment

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

now we report the listening host interface

lib/dev.js Outdated Show resolved Hide resolved
"start": "./cli.js docs",
"build": "./cli.js build docs",
"start": "node ./cli.js docs",
"build": "node ./cli.js build docs",
Copy link
Author

Choose a reason for hiding this comment

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

on windows 10, (powershell/cmd.exe) hashbangs have no effect.

@airtonix
Copy link
Author

Not sure how to deal with the failing test. It's choking on classnames.

@johno
Copy link
Member

johno commented Oct 17, 2018

Thanks @airtonix! This is looking great so far. I'm going to take this for a spin shortly. Btw, to fix the snapshot failure you can regenerate the snapshot with npm t -- -u.

@airtonix
Copy link
Author

airtonix commented Oct 18, 2018 via email

@airtonix
Copy link
Author

not sure why 5973ff1 failed. I updated the snapshots

@airtonix
Copy link
Author

./stumped

zenobius@JADAKREN ~\Projects\Mine\x0 [feature/104-replace-webpack-serve-with-webpack-dev-server*]
$ npm run test:components

> @compositor/[email protected] test:components C:\Users\zenobius\Projects\Mine\x0
> nyc ava test/components.js

The above error occurred in the <Throws> component:
    in Throws
    in Catch

React will try to recreate this component tree from scratch using the error boundary you provided, Catch.
Warning: You cannot change <Router history>
Warning: You cannot change <Router history>
Warning: You cannot change <Router history>

  31 passed
  1 skipped
-------------------|----------|----------|----------|----------|-------------------|
File               |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-------------------|----------|----------|----------|----------|-------------------|
All files          |    89.62 |    58.46 |    75.61 |    93.06 |                   |
 Catch.js          |    66.67 |       50 |      100 |    71.43 |             13,14 |
 CenteredLayout.js |      100 |      100 |      100 |      100 |                   |
 FileList.js       |      100 |       50 |      100 |      100 |                 4 |
 Library.js        |      100 |       50 |      100 |      100 |                50 |
 LiveEditor.js     |    73.68 |        0 |        0 |     87.5 |             50,58 |
 LivePreview.js    |      100 |      100 |      100 |      100 |                   |
 ScopeProvider.js  |      100 |      100 |      100 |      100 |                   |
 ScrollTop.js      |    92.31 |       75 |      100 |      100 |              4,14 |
 SidebarLayout.js  |    88.73 |    59.38 |    70.83 |    91.49 |   230,251,285,288 |
 scope.js          |     93.1 |    77.78 |      100 |       92 |             53,55 |
-------------------|----------|----------|----------|----------|-------------------|
zenobius@JADAKREN ~\Projects\Mine\x0 [feature/104-replace-webpack-serve-with-webpack-dev-server*]
$ npm test

> @compositor/[email protected] test C:\Users\zenobius\Projects\Mine\x0
> nyc ava --timeout=60s

The above error occurred in the <Throws> component:
    in Throws
    in Catch

React will try to recreate this component tree from scratch using the error boundary you provided, Catch.
Warning: You cannot change <Router history>
Warning: You cannot change <Router history>
Warning: You cannot change <Router history>
[BABEL] Note: The code generator has deoptimised the styling of "C:/Users/zenobius/Projects/Mine/x0/test/output/TEMP/App.js" as it exceeds the max of "500KB".

  35 passed
  1 skipped
--------------------|----------|----------|----------|----------|-------------------|
File                |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
--------------------|----------|----------|----------|----------|-------------------|
All files           |    83.08 |    55.56 |    81.08 |    84.59 |                   |
 lib                |    74.65 |    53.16 |    87.88 |    74.59 |                   |
  build.js          |    69.49 |    43.55 |       84 |     69.9 |... 18,219,222,223 |
  config.js         |      100 |      100 |      100 |      100 |                   |
  createTemplate.js |      100 |      100 |      100 |      100 |                   |
  mdx-fm-loader.js  |      100 |    66.67 |      100 |      100 |                 5 |
  template.js       |      100 |    91.67 |      100 |      100 |                 2 |
 src                |    89.62 |    58.46 |    75.61 |    93.06 |                   |
  Catch.js          |    66.67 |       50 |      100 |    71.43 |             13,14 |
  CenteredLayout.js |      100 |      100 |      100 |      100 |                   |
  FileList.js       |      100 |       50 |      100 |      100 |                 4 |
  Library.js        |      100 |       50 |      100 |      100 |                50 |
  LiveEditor.js     |    73.68 |        0 |        0 |     87.5 |             50,58 |
  LivePreview.js    |      100 |      100 |      100 |      100 |                   |
  ScopeProvider.js  |      100 |      100 |      100 |      100 |                   |
  ScrollTop.js      |    92.31 |       75 |      100 |      100 |              4,14 |
  SidebarLayout.js  |    88.73 |    59.38 |    70.83 |    91.49 |   230,251,285,288 |
  scope.js          |     93.1 |    77.78 |      100 |       92 |             53,55 |
--------------------|----------|----------|----------|----------|-------------------|
zenobius@JADAKREN ~\Projects\Mine\x0 [feature/104-replace-webpack-serve-with-webpack-dev-server*]
$

@airtonix
Copy link
Author

airtonix commented Oct 23, 2018

Ok this works on my personal website, you can try it out:

uses docker, npm run dev, uses docker image airtonix/zenobi.us:4.0.0-beta

@airtonix
Copy link
Author

airtonix commented Oct 23, 2018

So learnings here:

  • tests are sensitive to node 8 vs node 10
  • webpack-dev-server requires the plugins in e761671, no need to inject hot client as entry points like did back in webpack 2 days.
  • devServer: {hot: true } is a thing. it's required.

@johno ready for you guys to code review.

@johno
Copy link
Member

johno commented Nov 18, 2018

Thanks for this @airtonix 🙏! I'll be reviewing and testing this PR sometime this week and will get a release cut.

@johno johno mentioned this pull request Nov 18, 2018
10 tasks
@theRemix
Copy link

@airtonix i tested out your branch and i think you need to add the webpack-hot-client dependency

@airtonix airtonix closed this by deleting the head repository Oct 30, 2022
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.

No way to extend webpack-server options
3 participants