Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Cleanup reps loading (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonLaster committed Jan 10, 2017
1 parent d331565 commit f0a17da
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
18 changes: 14 additions & 4 deletions packages/devtools-launchpad/bin/development-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,28 @@ function httpOrHttpsGet(url, onResponse) {
});
}

function getFavicon() {
let favicon = getValue("favicon");

if (!favicon) {
return "launchpad-favicon.png";
}

return path.basename(favicon);
}

function serveRoot(req, res) {
const tplPath = path.join(__dirname, "../index.html");
const tplFile = fs.readFileSync(tplPath, "utf8");
const bundleName = getValue("title") ?
getValue("title").toLocaleLowerCase() : "bundle";

let favicon = getValue("favicon");
res.send(Mustache.render(tplFile, {
isDevelopment: isDevelopment(),
dir: getValue("dir") || "ltr",
bundleName,
title: getValue("title") || "Launchpad",
favicon: favicon
? path.basename(favicon)
: "launchpad-favicon.png"
favicon: getFavicon()
}));
}

Expand Down
4 changes: 2 additions & 2 deletions packages/devtools-launchpad/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<meta charset="utf8" />
<link rel="shortcut icon" href="{{favicon}}" type="image/png" />
{{^isDevelopment}}
<link rel="stylesheet" href="assets/build/styles.css" type="text/css" />
<link rel="stylesheet" href="assets/build/{{bundleName}}.css" type="text/css" />
{{/isDevelopment}}
</head>

<body>
<popupset></popupset>
<div id="mount"></div>
<script src="assets/build/bundle.js"></script>
<script src="assets/build/{{bundleName}}.js"></script>
</body>
</html>
2 changes: 0 additions & 2 deletions packages/devtools-launchpad/webpack.config.devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ let packagesPath = path.join(__dirname, "../");
const outputPath = process.env.OUTPUT_PATH;

module.exports = (webpackConfig, envConfig) => {
webpackConfig.output.library = "Debugger";

if (outputPath) {
webpackConfig.output.path = outputPath;
}
Expand Down
18 changes: 11 additions & 7 deletions packages/devtools-launchpad/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ module.exports = (webpackConfig, envConfig) => {
webpackConfig.module.loaders.push({
test: /\.js$/,
exclude: request => {
let excluded = request.match(/(node_modules|bower_components|fs|devtools-config)/);
let excluded = request.match(
/(node_modules|bower_components|fs|devtools-config)/
);
if (webpackConfig.babelExcludes) {
// If the tool defines an additional exclude regexp for Babel.
excluded = excluded || request.match(webpackConfig.babelExcludes);
Expand Down Expand Up @@ -57,8 +59,6 @@ module.exports = (webpackConfig, envConfig) => {
webpackConfig.externals = webpackConfig.externals || [];

function externalsTest(context, request, callback) {
let mod = request;

// Any matching paths here won't be included in the bundle.
if (ignoreRegexes.some(r => r.test(request))) {
return callback(null, "var {}");
Expand All @@ -84,12 +84,13 @@ module.exports = (webpackConfig, envConfig) => {
if (isDevelopment()) {
webpackConfig.module.loaders.push({
test: /\.css$/,
exclude: /lkjsdflksdjlksdj/,
loader: "style!css!postcss"
});

if (getValue("hotReloading")) {
webpackConfig.entry.bundle.push("webpack-hot-middleware/client");
Object.keys(webpackConfig.entry).forEach(key => {
webpackConfig.entry[key].push("webpack-hot-middleware/client");

This comment has been minimized.

Copy link
@clarkbw

clarkbw Jan 11, 2017

Contributor

I believe this change is breaking the debugger.html. Not every value is an array so push fails.

https://github.com/devtools-html/debugger.html/blob/master/webpack.config.js#L10-L14

});

webpackConfig.plugins = webpackConfig.plugins.concat([
new webpack.HotModuleReplacementPlugin(),
Expand All @@ -108,9 +109,12 @@ module.exports = (webpackConfig, envConfig) => {
test: /\.css$/,
exclude: request => {
// If the tool defines an exclude regexp for CSS files.
return webpackConfig.cssExcludes && request.match(webpackConfig.cssExcludes);
return webpackConfig.cssExcludes
&& request.match(webpackConfig.cssExcludes);
},
loader: ExtractTextPlugin.extract("style-loader", "css-loader", "postcss-loader")
loader: ExtractTextPlugin.extract(
"style-loader", "css-loader", "postcss-loader"
)
});

webpackConfig.plugins.push(new ExtractTextPlugin("[name].css"));
Expand Down

0 comments on commit f0a17da

Please sign in to comment.