-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in explicit support for Neutrino, and include an examples folder
- Loading branch information
1 parent
2cf8023
commit 36487a4
Showing
6 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin"); | ||
|
||
const smp = new SpeedMeasurePlugin(); | ||
|
||
module.exports = smp.wrap({ | ||
entry: { | ||
app: ["./app.js"] | ||
}, | ||
output: "./public", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
use: [{ loader: "babel-loader" }] | ||
} | ||
] | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
use: [ | ||
"@neutrinojs/airbnb", | ||
"@neutrinojs/jest", | ||
|
||
// Make sure this is last! This strongly depends on being placed last | ||
"speed-measure-webpack-plugin/neutrino" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const merge = require("webpack-merge"); | ||
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin"); | ||
|
||
const smp = new SpeedMeasurePlugin(); | ||
const TARGET = process.env.npm_lifecycle_event; | ||
|
||
const commonConfig = { | ||
entry: { | ||
app: ["./app.js"] | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.css$/, | ||
loaders: ["style", "css"], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
let mergedConfig = commonConfig; | ||
|
||
if(TARGET === "start") { | ||
mergedConfig = merge(common, { | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.jsx?$/, | ||
loader: "babel?stage=1" | ||
} | ||
] | ||
} | ||
}); | ||
} | ||
|
||
// The only difference to how you normally use webpack-merge is that you need | ||
// to `smp.wrap` whatever your final config is | ||
module.exports = smp.wrap(mergedConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const SpeedMeasurePlugin = require("."); | ||
const smp = new SpeedMeasurePlugin(); | ||
|
||
module.exports = neutrino => { | ||
const origConfig = neutrino.config; | ||
const wrappedConfig = smp.wrap(origConfig.toConfig()); | ||
neutrino.config = new Proxy(origConfig, { | ||
get(target, property) { | ||
if (property === "toConfig") { | ||
return () => wrappedConfig; | ||
} | ||
return target[property]; | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters