Skip to content

Commit

Permalink
Move index.js to src/content/index.js to speed up webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatum authored and mstange committed Jan 31, 2017
1 parent 42f8ae7 commit 3f77bc6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "perf.html",
"version": "0.0.1",
"description": "perf.html, the gecko profiler UI",
"main": "index.js",
"main": "src/content/index.js",
"scripts": {
"test": "npm run build && npm run test-all",
"test-all": "NODE_ENV=test nyc mocha --compilers js:babel-core/register 'test/**/*.js' 'src/**/test/*.js'",
Expand All @@ -18,8 +18,8 @@
"build-prod": "npm run build:clean && NODE_ENV=production webpack -p --progress",
"build:clean": "rimraf dist && mkdirp dist && cp res/.htaccess dist/ && cp res/zee-worker.js dist/",
"publish": "rimraf public_html && cp -r dist public_html",
"eslint": "eslint index.js src",
"eslint-fix": "eslint --fix index.js src",
"eslint": "eslint src",
"eslint-fix": "eslint --fix src",
"documentation": "documentation"
},
"author": "Markus Stange <[email protected]>",
Expand Down
6 changes: 3 additions & 3 deletions index.js → src/content/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import Perf from 'react-addons-perf';
import { render } from 'react-dom';
import Root from './src/content/containers/Root';
import createStore from './src/content/create-store';
import './res/style.css';
import Root from './containers/Root';
import createStore from './create-store';
import '../../res/style.css';

if (process.env.NODE_ENV === 'production') {
const runtime = require('offline-plugin/runtime');
Expand Down
13 changes: 8 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const OfflinePlugin = require('offline-plugin');

const includes = [
path.join(__dirname, 'src'),
path.join(__dirname, 'res'),
];
const baseConfig = {
plugins: [
new webpack.DefinePlugin({
Expand Down Expand Up @@ -36,15 +39,15 @@ const baseConfig = {
rules: [{
test: /\.js$/,
loaders: ['babel-loader'],
include: __dirname,
include: includes,
}, {
test: /\.json$/,
loaders: ['json-loader'],
include: __dirname,
include: includes,
}, {
test: /\.css?$/,
loaders: ['style-loader', 'css-loader?minimize'],
include: __dirname,
include: includes,
}, {
test: /\.jpg$/,
loader: 'file-loader',
Expand Down Expand Up @@ -85,7 +88,7 @@ if (process.env.NODE_ENV === 'production') {
module.exports = [
{
entry: [
'./index',
'./src/content/index',
],
output: {
path: path.join(__dirname, 'dist'),
Expand Down

0 comments on commit 3f77bc6

Please sign in to comment.