File tree Expand file tree Collapse file tree 6 files changed +84
-2
lines changed
Expand file tree Collapse file tree 6 files changed +84
-2
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,9 @@ const webpackConfig = smp.wrap({
6161});
6262```
6363
64- and you're done! SMP will now be printing timing output to the console by default
64+ and you're done! SMP will now be printing timing output to the console by default.
65+
66+ Check out the [ examples folder] ( /examples ) for some more examples.
6567
6668## Options
6769
Original file line number Diff line number Diff line change 1+ const SpeedMeasurePlugin = require ( "speed-measure-webpack-plugin" ) ;
2+
3+ const smp = new SpeedMeasurePlugin ( ) ;
4+
5+ module . exports = smp . wrap ( {
6+ entry : {
7+ app : [ "./app.js" ]
8+ } ,
9+ output : "./public" ,
10+ module : {
11+ rules : [
12+ {
13+ test : / \. j s $ / ,
14+ use : [ { loader : "babel-loader" } ]
15+ }
16+ ]
17+ }
18+ } ) ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ use : [
3+ "@neutrinojs/airbnb" ,
4+ "@neutrinojs/jest" ,
5+
6+ // Make sure this is last! This strongly depends on being placed last
7+ "speed-measure-webpack-plugin/neutrino"
8+ ]
9+ }
Original file line number Diff line number Diff line change 1+ const merge = require ( "webpack-merge" ) ;
2+ const SpeedMeasurePlugin = require ( "speed-measure-webpack-plugin" ) ;
3+
4+ const smp = new SpeedMeasurePlugin ( ) ;
5+ const TARGET = process . env . npm_lifecycle_event ;
6+
7+ const commonConfig = {
8+ entry : {
9+ app : [ "./app.js" ]
10+ } ,
11+ module : {
12+ loaders : [
13+ {
14+ test : / \. c s s $ / ,
15+ loaders : [ "style" , "css" ] ,
16+ } ,
17+ ] ,
18+ } ,
19+ } ;
20+
21+ let mergedConfig = commonConfig ;
22+
23+ if ( TARGET === "start" ) {
24+ mergedConfig = merge ( common , {
25+ module : {
26+ loaders : [
27+ {
28+ test : / \. j s x ? $ / ,
29+ loader : "babel?stage=1"
30+ }
31+ ]
32+ }
33+ } ) ;
34+ }
35+
36+ // The only difference to how you normally use webpack-merge is that you need
37+ // to `smp.wrap` whatever your final config is
38+ module . exports = smp . wrap ( mergedConfig ) ;
Original file line number Diff line number Diff line change 1+ const SpeedMeasurePlugin = require ( "." ) ;
2+ const smp = new SpeedMeasurePlugin ( ) ;
3+
4+ module . exports = neutrino => {
5+ const origConfig = neutrino . config ;
6+ const wrappedConfig = smp . wrap ( origConfig . toConfig ( ) ) ;
7+ neutrino . config = new Proxy ( origConfig , {
8+ get ( target , property ) {
9+ if ( property === "toConfig" ) {
10+ return ( ) => wrappedConfig ;
11+ }
12+ return target [ property ] ;
13+ } ,
14+ } ) ;
15+ } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " speed-measure-webpack-plugin" ,
3- "version" : " 1.0.2 " ,
3+ "version" : " 1.1.0 " ,
44 "description" : " Measure + analyse the speed of your webpack loaders and plugins" ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments