-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1775 from thomasbertet/fix-ordering-chunk-load
Use HtmlWebpackPlugin to import all assets (importing chunks in order)
- Loading branch information
Showing
55 changed files
with
733 additions
and
883 deletions.
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
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
112 changes: 62 additions & 50 deletions
112
app/react-native/src/server/config/webpack.config.prod.js
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,57 +1,69 @@ | ||
import path from 'path'; | ||
import webpack from 'webpack'; | ||
import HtmlWebpackPlugin from 'html-webpack-plugin'; | ||
import { OccurenceOrderPlugin, includePaths, excludePaths } from './utils'; | ||
|
||
const config = { | ||
bail: true, | ||
devtool: '#cheap-module-source-map', | ||
entry: { | ||
manager: [path.resolve(__dirname, '../../manager')], | ||
}, | ||
output: { | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'static/[name].bundle.js', | ||
// Here we set the publicPath to ''. | ||
// This allows us to deploy storybook into subpaths like GitHub pages. | ||
// This works with css and image loaders too. | ||
// This is working for storybook since, we don't use pushState urls and | ||
// relative URLs works always. | ||
publicPath: '/', | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }), | ||
new webpack.optimize.DedupePlugin(), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
screw_ie8: true, | ||
warnings: false, | ||
}, | ||
mangle: { | ||
screw_ie8: true, | ||
}, | ||
output: { | ||
comments: false, | ||
screw_ie8: true, | ||
}, | ||
}), | ||
], | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.jsx?$/, | ||
loader: require.resolve('babel-loader'), | ||
query: require('./babel.prod.js'), // eslint-disable-line | ||
include: includePaths, | ||
exclude: excludePaths, | ||
}, | ||
const getConfig = options => { | ||
const config = { | ||
bail: true, | ||
devtool: '#cheap-module-source-map', | ||
entry: { | ||
manager: [path.resolve(__dirname, '../../manager')], | ||
}, | ||
output: { | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'static/[name].bundle.js', | ||
// Here we set the publicPath to ''. | ||
// This allows us to deploy storybook into subpaths like GitHub pages. | ||
// This works with css and image loaders too. | ||
// This is working for storybook since, we don't use pushState urls and | ||
// relative URLs works always. | ||
publicPath: '/', | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
filename: 'index.html', | ||
data: { | ||
options: JSON.stringify(options), | ||
}, | ||
template: require.resolve('../index.html.ejs'), | ||
}), | ||
new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }), | ||
new webpack.optimize.DedupePlugin(), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
screw_ie8: true, | ||
warnings: false, | ||
}, | ||
mangle: { | ||
screw_ie8: true, | ||
}, | ||
output: { | ||
comments: false, | ||
screw_ie8: true, | ||
}, | ||
}), | ||
], | ||
}, | ||
}; | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.jsx?$/, | ||
loader: require.resolve('babel-loader'), | ||
query: require('./babel.prod.js'), // eslint-disable-line | ||
include: includePaths, | ||
exclude: excludePaths, | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
// Webpack 2 doesn't have a OccurenceOrderPlugin plugin in the production mode. | ||
// But webpack 1 has it. That's why we do this. | ||
if (OccurenceOrderPlugin) { | ||
config.plugins.unshift(new OccurenceOrderPlugin()); | ||
} | ||
// Webpack 2 doesn't have a OccurenceOrderPlugin plugin in the production mode. | ||
// But webpack 1 has it. That's why we do this. | ||
if (OccurenceOrderPlugin) { | ||
config.plugins.unshift(new OccurenceOrderPlugin()); | ||
} | ||
|
||
return config; | ||
}; | ||
|
||
export default config; | ||
export default getConfig; |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Storybook for React</title> | ||
<style> | ||
/* Styling the fuzzy search box placeholders */ | ||
.searchBox::-webkit-input-placeholder { /* Chrome/Opera/Safari */ | ||
color: #ddd; | ||
font-size: 16px; | ||
} | ||
.searchBox::-moz-placeholder { /* Firefox 19+ */ | ||
color: #ddd; | ||
font-size: 16px; | ||
} | ||
.searchBox:focus{ | ||
border-color: #EEE !important; | ||
} | ||
.btn:hover{ | ||
background-color: #eee | ||
} | ||
</style> | ||
</head> | ||
<body style="margin: 0;"> | ||
<div id="root"></div> | ||
<script> | ||
window.storybookOptions = <%= htmlWebpackPlugin.options.data.options %>; | ||
</script> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
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
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
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.