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

Remove webpack-dev-server #276

Merged
merged 3 commits into from
Nov 23, 2016
Merged

Remove webpack-dev-server #276

merged 3 commits into from
Nov 23, 2016

Conversation

nkzawa
Copy link
Contributor

@nkzawa nkzawa commented Nov 18, 2016

Fixes #236, #102

By using webpack-hot-middleware, we can use HMR from our server instead of running a dedicated server (webpack-dev-server).

@@ -144,7 +146,7 @@ export default async function createCompiler (dir, { hotReload = false, dev = fa
path: join(dir, '.next'),
filename: '[name]',
libraryTarget: 'commonjs2',
publicPath: hotReload ? 'http://localhost:3030/' : null
publicPath: hotReload ? '/_webpack' : null
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't it be /_webpack/ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, fixed, thanks!

@nkzawa nkzawa mentioned this pull request Nov 22, 2016
@rauchg rauchg merged commit a14cc66 into master Nov 23, 2016
@rauchg rauchg deleted the fix/replace-webpack-dev-server branch November 23, 2016 18:32
@jonaswindey
Copy link
Contributor

Trying to run a locally built version with node dist/bin/next

getting error

ERROR in multi bundles/pages/_error.js
Module not found: Error: Cannot resolve module 'next/dist/client/webpack-hot-middleware-client' in /Users/jonas/Development/github/next.js
 @ multi bundles/pages/_error.js

@jonaswindey
Copy link
Contributor

Also, when adding a new page (test.js) in /dist/pages

import React from 'react'

export default () => <div>hi</div>

I get the following error:

ERROR in multi bundles/pages/test.js
Module not found: Error: Cannot resolve module 'next/dist/client/webpack-hot-middleware-client' in /Users/jonas/Development/github/next.js/dist
 @ multi bundles/pages/test.js
> Ready on http://localhost:3000
/Users/jonas/Development/github/next.js/dist/server/build/plugins/watch-pages-plugin.js:53
          return _this.prevFileDependencies.indexOf(f) < 0;
                                           ^

TypeError: Cannot read property 'indexOf' of null
    at /Users/jonas/Development/github/next.js/dist/server/build/plugins/watch-pages-plugin.js:53:44
    at Array.filter (native)
    at Compiler.<anonymous> (/Users/jonas/Development/github/next.js/dist/server/build/plugins/watch-pages-plugin.js:52:73)
    at Compiler.applyPluginsAsync (/Users/jonas/Development/github/next.js/node_modules/tapable/lib/Tapable.js:71:13)
    at Watching._go (/Users/jonas/Development/github/next.js/node_modules/webpack/lib/Compiler.js:44:16)
    at Watching.invalidate (/Users/jonas/Development/github/next.js/node_modules/webpack/lib/Compiler.js:108:8)
    at Watching.<anonymous> (/Users/jonas/Development/github/next.js/node_modules/webpack/lib/Compiler.js:93:8)
    at /Users/jonas/Development/github/next.js/dist/server/build/plugins/watch-remove-event-plugin.js:45:22
    at NodeWatchFileSystem.<anonymous> (/Users/jonas/Development/github/next.js/node_modules/webpack/lib/node/NodeWatchFileSystem.js:43:3)
    at EventEmitter.g (events.js:286:16)

@jonaswindey
Copy link
Contributor

@nkzawa

@nkzawa
Copy link
Contributor Author

nkzawa commented Nov 24, 2016

@jonaswindey hmm, I can't reproduce. I did clean install (rm -rf node_modules && npm i). How did you install next locally ?

@jonaswindey
Copy link
Contributor

jonaswindey commented Nov 24, 2016

@nkzawa

mkdir tmp
git clone https://github.com/zeit/next.js.git tmp && cd tmp
npm i
node dist/bin/next
ERROR in multi bundles/pages/_error.js
Module not found: Error: Cannot resolve module 'next/dist/client/webpack-hot-middleware-client' in /Users/jonas/Development/sandbox/tmp
 @ multi bundles/pages/_error.js
> Ready on http://localhost:3000

@nkzawa
Copy link
Contributor Author

nkzawa commented Nov 24, 2016

@jonaswindey it looks you executed dist/bin/next on the root directory of next.js ?
You have to do it on the directory of your app, or pass a directory to the command argument like ./dist/bin/next ../../my-next-app.

@jonaswindey
Copy link
Contributor

@nkzawa if I do this on the latest commit from yesterday that command still works, and not anymore.

this was the command I use to run next locally and this allowed me to test pages when creating them under /dist/pages

how do you run 'next' locally when you want to test your own examples?

@nkzawa
Copy link
Contributor Author

nkzawa commented Nov 24, 2016

@jonaswindey these are not supported even if worked before by accident. I recommend to use npm link which allows you to install local modules.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
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.

4 participants