Skip to content

Commit

Permalink
feat/add js source mapping
Browse files Browse the repository at this point in the history
alt + r for dev tool update
webpack/webpack#2478
  • Loading branch information
seeliang committed Dec 30, 2017
1 parent 7f71b4c commit d68143c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/index.js
Expand Up @@ -2,11 +2,21 @@ import React from 'react';
import {render} from 'react-dom';

class Root extends React.Component {
constructor(props) {
super(props);
this.click = this.click.bind(this);
}

click() {
alert('click this');
}

render() {
return (
<div>
<h1> Hello world</h1>
<input type="checkbox"/>
<button onClick={this.click}> try this</button>
</div>
);
}
Expand Down
9 changes: 8 additions & 1 deletion webpack.dev.js
@@ -1,4 +1,5 @@
const base = require('./webpack.base.js'),
webpack = require('webpack'),
dev = {
module: {
loaders: [{
Expand All @@ -10,7 +11,13 @@ const base = require('./webpack.base.js'),
presets: [ 'es2015', 'react', 'react-hmre' ]
}
}]
}
},
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map',
exclude: ['vendor.js']
})
]
};

module.exports = Object.assign(base, dev);

0 comments on commit d68143c

Please sign in to comment.