Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Webpack 2 #355

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "1.0.0",
"description": "Red Badger Website. Honestly.",
"dependencies": {
"assets-webpack-plugin": "^3.4.0",
"autoprefixer": "^6.4.1",
"assets-webpack-plugin": "^3.5.1",
"autoprefixer": "^6.7.1",
"babel-core": "^6.14.0",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.5",
"babel-loader": "^6.2.10",
"babel-plugin-transform-class-properties": "^6.16.0",
"babel-plugin-transform-export-extensions": "^6.8.0",
"babel-plugin-transform-flow-strip-types": "^6.18.0",
Expand All @@ -21,8 +21,8 @@
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"classnames": "^2.2.5",
"copy-webpack-plugin": "^3.0.1",
"css-loader": "^0.25.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.26.1",
"css-modules-require-hook": "^4.0.3",
"deep-extend": "^0.4.1",
"empty": "^0.10.1",
Expand All @@ -36,8 +36,8 @@
"eslint-plugin-import": "^1.15.0",
"eslint-plugin-jsx-a11y": "^2.2.2",
"eslint-plugin-react": "^6.2.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"extract-text-webpack-plugin": "grrowl/extract-text-webpack-plugin#order-undefined-error",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fork allows ignoring the undefined order of our CSS modules. We should fix this at its root cause but it's not entirely clear how to do that at the moment: webpack-contrib/extract-text-webpack-plugin#166

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Order in extracted chunk" errors have decreased, but not gone. There were 44 and there are now 12. They all flag up against the same file ./site/components/header/style.css

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point is that they don't fail the build with this fork. I did try and correct the issue in header/style.css but didn't make much progress. Practically, it won't matter unless there are styles with exactly the same level of specificity being generated in a non-deterministic order.

"file-loader": "^0.10.0",
"flow-bin": "^0.36.0",
"flow-typed": "^2.0.0",
"html-webpack-plugin": "^2.22.0",
Expand All @@ -57,7 +57,7 @@
"node-fetch": "^1.6.3",
"node-hook": "^0.4.0",
"param-case": "^2.1.0",
"postcss-loader": "^0.13.0",
"postcss-loader": "^1.2.2",
"pre-git": "^3.10.0",
"ramda": "^0.22.1",
"raw-loader": "^0.5.1",
Expand All @@ -70,13 +70,13 @@
"serverless": "1.0.0-rc.1",
"style-loader": "^0.13.1",
"svg-inline-loader": "^0.7.1",
"svg-inline-react": "^1.0.2",
"svgo": "^0.7.1",
"svg-inline-react": "^1.0.3",
"svgo": "^0.7.2",
"twitter": "^1.7.0",
"underscore-template-loader": "^0.7.3",
"webpack": "^1.13.2",
"webpack": "^2.2.1",
"webpack-dev-server": "^1.15.2",
"webpack-merge": "^0.14.1",
"webpack-merge": "^2.6.1",
"whatwg-fetch": "^1.0.0",
"xmldom": "^0.1.22"
},
Expand Down
28 changes: 9 additions & 19 deletions webpack.base.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const autoprefixer = require('autoprefixer');

const publicPath = `/${process.env.URL_BASENAME || ''}`;
const robots = process.env.ALLOW_ROBOTS ? 'robots-allow.txt' : 'robots-disallow.txt';
Expand All @@ -15,15 +15,15 @@ const baseConfig = {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader'
),
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader',
}),
},
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel'],
loader: 'babel-loader',
},
{
test: /\.json$/,
Expand All @@ -40,34 +40,24 @@ const baseConfig = {
},
{
test: /\.svg$/,
loader: 'svg-inline',
loader: 'svg-inline-loader',
},
{
test: /\.ejs/,
loader: 'underscore-template-loader',
},
],
},
postcss() {
return [
autoprefixer,
];
},
devtool: 'source-map',
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.EnvironmentPlugin(Object.keys(process.env)),
new ExtractTextPlugin(
'assets-honestly/styles-[contenthash:base64:5].css',
{ allChunks: true }
),
new webpack.LoaderOptionsPlugin({ options: { context: __dirname, postcss: [autoprefixer] } }),
new ExtractTextPlugin({ allChunks: true, filename: 'assets-honestly/styles-[contenthash:base64:5].css', ignoreOrder: true }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This same ExtractTextPlugin change needs to go in webpack.dev.browser.config.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes - I won't be able to work on this today though.

new CopyWebpackPlugin([
{ from: 'assets/favicons', to: 'assets-honestly/favicons' },
{ from: 'assets/social', to: 'assets-honestly/social' },
{ from: `assets/${robots}`, to: 'robots.txt' },
{ from: 'assets/state.json', to: 'state.json' },
{ from: 'assets/txt', to: 'txt/' },
{ from: 'assets/fonts', to: 'assets-honestly/' },
]),
Expand Down
4 changes: 4 additions & 0 deletions webpack.dev.browser.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const baseConfig = require('./webpack.base.config');
const webpackMerge = require('webpack-merge').smart;
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const devAppConfig = webpackMerge(baseConfig, {
entry: {
Expand All @@ -16,6 +17,9 @@ const devAppConfig = webpackMerge(baseConfig, {
'/assets-honestly/styles-[contenthash:base64:5].css',
{ allChunks: true }
),
new CopyWebpackPlugin([
{ from: 'assets/state.json', to: 'state.json' },
]),
],
});

Expand Down
2 changes: 1 addition & 1 deletion webpack.sw.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const swConfig = {
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel'],
loader: 'babel-loader',
},
{
test: /\.json$/,
Expand Down
Loading