Skip to content

Commit

Permalink
Add support for a static folder
Browse files Browse the repository at this point in the history
It is a nice escape hatch, ref: #28
  • Loading branch information
mxstbr committed Jul 26, 2016
1 parent 1670fb1 commit fd41c2d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if (isInCreateReactAppSource) {
appFavicon: resolve('../template/favicon.ico'),
appPackageJson: resolve('../package.json'),
appSrc: resolve('../template/src'),
appStatic: resolve('../template/static'),
appNodeModules: resolve('../node_modules'),
ownNodeModules: resolve('../node_modules')
};
Expand All @@ -46,6 +47,7 @@ if (isInCreateReactAppSource) {
appFavicon: resolve('../../../favicon.ico'),
appPackageJson: resolve('../../../package.json'),
appSrc: resolve('../../../src'),
appStatic: resolve('../../../static'),
appNodeModules: resolve('../..'),
// this is empty with npm3 but node resolution searches higher anyway:
ownNodeModules: resolve('../node_modules')
Expand All @@ -58,6 +60,7 @@ if (isInCreateReactAppSource) {
appFavicon: resolve('../favicon.ico'),
appPackageJson: resolve('../package.json'),
appSrc: resolve('../src'),
appStatic: resolve('../static'),
appNodeModules: resolve('../node_modules'),
ownNodeModules: resolve('../node_modules')
};
Expand Down
4 changes: 4 additions & 0 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var path = require('path');
var autoprefixer = require('autoprefixer');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var paths = require('./paths');

module.exports = {
Expand Down Expand Up @@ -85,6 +86,9 @@ module.exports = {
favicon: paths.appFavicon,
}),
new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"development"' }),
new CopyWebpackPlugin([
{ from: paths.appStatic, to: 'static' }
]),
// Note: only CSS is currently hot reloaded
new webpack.HotModuleReplacementPlugin()
]
Expand Down
4 changes: 4 additions & 0 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var path = require('path');
var autoprefixer = require('autoprefixer');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var url = require('url');
var paths = require('./paths');
Expand Down Expand Up @@ -109,6 +110,9 @@ module.exports = {
new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new CopyWebpackPlugin([
{ from: paths.appStatic, to: 'static' }
]),
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"babel-preset-es2016": "6.11.3",
"babel-preset-react": "6.11.1",
"chalk": "1.1.3",
"copy-webpack-plugin": "3.0.1",
"cross-spawn": "4.0.0",
"css-loader": "0.23.1",
"eslint": "3.1.1",
Expand Down

0 comments on commit fd41c2d

Please sign in to comment.