This repository has been archived by the owner on Feb 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Webpack 2 #355
Closed
Closed
Webpack 2 #355
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -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'; | ||
|
@@ -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$/, | ||
|
@@ -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 }), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This same There was a problem hiding this comment. Choose a reason for hiding this commentThe 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/' }, | ||
]), | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.