Created
November 17, 2016 20:24
-
-
Save juliandescottes/e5853d2f4edd13bf15a36c04992421e1 to your computer and use it in GitHub Desktop.
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
diff --git a/packages/devtools-local-toolbox/bin/development-server.js b/packages/devtools-local-toolbox/bin/development-server.js | |
index c1f34cf..fa50da3 100755 | |
--- a/packages/devtools-local-toolbox/bin/development-server.js | |
+++ b/packages/devtools-local-toolbox/bin/development-server.js | |
@@ -32,8 +32,8 @@ function httpGet(url, onResponse) { | |
}); | |
} | |
-function serveRoot(req, res) { | |
- const tplPath = path.join(__dirname, "../index.html"); | |
+function serveRoot(req, res, root) { | |
+ const tplPath = root; | |
const tplFile = fs.readFileSync(tplPath, "utf8"); | |
res.send(Mustache.render(tplFile, { isDevelopment: isDevelopment() })); | |
} | |
@@ -90,7 +90,9 @@ function startDevServer(devConfig, webpackConfig) { | |
// setup app | |
const app = express(); | |
app.use(express.static("assets/build")); | |
- app.get("/", serveRoot); | |
+ app.get("/", function(req, res) { | |
+ serveRoot(req, res, devConfig.root); | |
+ }); | |
app.get("/get", handleNetworkRequest); | |
const serverPort = getValue("development.serverPort"); | |
app.listen(serverPort, "0.0.0.0", onRequest); | |
@@ -98,10 +100,9 @@ function startDevServer(devConfig, webpackConfig) { | |
const compiler = webpack(webpackConfig); | |
app.use(webpackDevMiddleware(compiler, { | |
publicPath: webpackConfig.output.publicPath, | |
- noInfo: true, | |
+ noInfo: false, | |
stats: { colors: true } | |
})); | |
- | |
if (getValue("hotReloading")) { | |
app.use(webpackHotMiddleware(compiler)); | |
} else { | |
diff --git a/packages/devtools-local-toolbox/webpack.config.js b/packages/devtools-local-toolbox/webpack.config.js | |
index 50a670a..63bd2fa 100644 | |
--- a/packages/devtools-local-toolbox/webpack.config.js | |
+++ b/packages/devtools-local-toolbox/webpack.config.js | |
@@ -19,32 +19,35 @@ module.exports = (webpackConfig, envConfig) => { | |
webpackConfig.resolve = merge({ | |
alias: { | |
- "devtools/client/shared/vendor/react": "react", | |
- "devtools/client/shared/vendor/react-dom": "react-dom" | |
+ // "devtools/client/shared/vendor/react": "react", | |
+ // "devtools/client/shared/vendor/react-dom": "react-dom" | |
} | |
}, webpackConfig.resolve); | |
- webpackConfig.module = { | |
+ webpackConfig.module = webpackConfig.module || {}; | |
+ webpackConfig.module.loaders = webpackConfig.module.loaders || []; | |
+ webpackConfig.module.loaders.push({ | |
+ test: /\.json$/, | |
+ loader: "json" | |
+ }); | |
+ webpackConfig.module.loaders.push({ | |
+ test: /\.js$/, | |
+ exclude: /(node_modules|bower_components|fs|devtools\/|addon-sdk|modules\/)/, | |
loaders: [ | |
- { test: /\.json$/, | |
- loader: "json" }, | |
- { test: /\.js$/, | |
- exclude: /(node_modules|bower_components|fs)/, | |
- loaders: [ | |
- "babel?" + | |
- defaultBabelPlugins.map(p => "plugins[]=" + p) + | |
- "&ignore=src/lib" | |
- ], | |
- isJavaScriptLoader: true | |
- }, | |
- { test: /\.svg$/, | |
- exclude: /lkdjlskdjslkdjsdlk/, | |
- loader: "svg-inline" } | |
- ] | |
- }; | |
+ "babel?" + | |
+ defaultBabelPlugins.map(p => "plugins[]=" + p) + | |
+ "&ignore=src/lib" | |
+ ], | |
+ isJavaScriptLoader: true | |
+ }); | |
+ webpackConfig.module.loaders.push({ | |
+ test: /\.svg$/, | |
+ exclude: /lkdjlskdjslkdjsdlk/, | |
+ loader: "svg-inline" | |
+ }); | |
const ignoreRegexes = [/^fs$/]; | |
- webpackConfig.externals = []; | |
+ webpackConfig.externals = webpackConfig.externals || []; | |
function externalsTest(context, request, callback) { | |
let mod = request; | |
@@ -57,15 +60,14 @@ module.exports = (webpackConfig, envConfig) => { | |
} | |
webpackConfig.externals.push(externalsTest); | |
- webpackConfig.plugins = [ | |
- new webpack.DefinePlugin({ | |
- "process.env": { | |
- NODE_ENV: JSON.stringify(NODE_ENV), | |
- TARGET: JSON.stringify("local") | |
- }, | |
- "DebuggerConfig": JSON.stringify(envConfig) | |
- }) | |
- ]; | |
+ webpackConfig.plugins = webpackConfig.plugins || []; | |
+ webpackConfig.plugins.push(new webpack.DefinePlugin({ | |
+ "process.env": { | |
+ NODE_ENV: JSON.stringify(NODE_ENV), | |
+ TARGET: JSON.stringify("local") | |
+ }, | |
+ "DebuggerConfig": JSON.stringify(envConfig) | |
+ })); | |
if (isDevelopment()) { | |
webpackConfig.module.loaders.push({ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment