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

modified package.json and wabpack.config #6

Open
wants to merge 1 commit into
base: HotModuleReplacement
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,14 @@ import Message from './model/message.model';

console.log('Index started');
console.dir(new Message());

/* eslint no-undef: 0 */
document.getElementById('send').onclick = () => {
const m = new Message(document.getElementById('message').value);
document.getElementById('messages').innerHTML +=
`<li>${m.text} ${m.created}<li>`;
};

if (module && module.hot) {
module.hot.accept();
}
48 changes: 48 additions & 0 deletions npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
0 info it worked if it ends with ok
1 verbose cli [ '/home/jozielio/.nvm/versions/node/v6.11.5/bin/node',
1 verbose cli '/home/jozielio/.nvm/versions/node/v6.11.5/bin/npm',
1 verbose cli 'run',
1 verbose cli 'hot' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prehot', 'hot', 'posthot' ]
5 info lifecycle [email protected]~prehot: [email protected]
6 silly lifecycle [email protected]~prehot: no script for prehot, continuing
7 info lifecycle [email protected]~hot: [email protected]
8 verbose lifecycle [email protected]~hot: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~hot: PATH: /home/jozielio/.nvm/versions/node/v6.11.5/lib/node_modules/npm/bin/node-gyp-bin:/home/jozielio/Documentos/Cursos/es6/node_modules/.bin:/home/jozielio/.nvm/versions/node/v6.11.5/bin:/home/jozielio/bin:/home/jozielio/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle [email protected]~hot: CWD: /home/jozielio/Documentos/Cursos/es6
11 silly lifecycle [email protected]~hot: Args: [ '-c', 'NODE_ENV=hot webpack-dev-server' ]
12 silly lifecycle [email protected]~hot: Returned: code: 1 signal: null
13 info lifecycle [email protected]~hot: Failed to exec hot script
14 verbose stack Error: [email protected] hot: `NODE_ENV=hot webpack-dev-server`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/home/jozielio/.nvm/versions/node/v6.11.5/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/home/jozielio/.nvm/versions/node/v6.11.5/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:920:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
15 verbose pkgid [email protected]
16 verbose cwd /home/jozielio/Documentos/Cursos/es6
17 error Linux 4.10.0-37-generic
18 error argv "/home/jozielio/.nvm/versions/node/v6.11.5/bin/node" "/home/jozielio/.nvm/versions/node/v6.11.5/bin/npm" "run" "hot"
19 error node v6.11.5
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error [email protected] hot: `NODE_ENV=hot webpack-dev-server`
22 error Exit status 1
23 error Failed at the [email protected] hot script 'NODE_ENV=hot webpack-dev-server'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the ecmascript2015-fast-course package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error NODE_ENV=hot webpack-dev-server
23 error You can get information on how to open an issue for this project with:
23 error npm bugs ecmascript2015-fast-course
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls ecmascript2015-fast-course
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build:prod": "webpack",
"nodemon": "nodemon",
"serve": "webpack-dev-server",
"hot": "NODE_ENV=hot webpack-dev-server",
"express": "NODE_ENV=development PORT=8080 node server.js",
"express:prod": "npm run build:prod && PORT=8081 node server.js"
},
Expand Down
9 changes: 9 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path');
const webpack = require('webpack');

const config = {
entry: './app/index.js',
Expand All @@ -12,6 +13,14 @@ const config = {
if (process.env.NODE_ENV === 'development') {
config.watch = true;
config.devtool = 'source-map';
} else if (process.env.NODE_ENV === 'hot') {
config.devtool = 'source-map';
config.devServer = {
hot: true,
};
config.plugins = [
new webpack.HotModuleReplacementPlugin(),
];
}

module.exports = config;