Config production env in webpack for docs
parent
b126fe7471
commit
b789ed03aa
|
@ -21,12 +21,14 @@
|
|||
"babel-loader": "^5.3.2",
|
||||
"css-loader": "^0.21.0",
|
||||
"extract-text-webpack-plugin": "^0.8.2",
|
||||
"html-webpack-plugin": "^1.6.2",
|
||||
"node-sass": "^3.3.3",
|
||||
"postcss-loader": "^0.7.0",
|
||||
"raw-loader": "^0.5.1",
|
||||
"react-hot-loader": "^1.3.0",
|
||||
"sass-loader": "^3.0.0",
|
||||
"style-loader": "^0.13.0",
|
||||
"transfer-webpack-plugin": "^0.1.4",
|
||||
"webpack": "^1.12.0",
|
||||
"webpack-dev-server": "^1.12.1"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const webpack = require('webpack');
|
||||
const WebpackDevServer = require('webpack-dev-server');
|
||||
const config = require('./webpack.config');
|
||||
const config = require('./webpack.config.development');
|
||||
const devServer = {
|
||||
host: '0.0.0.0',
|
||||
port: 8080,
|
||||
|
@ -8,6 +8,7 @@ const devServer = {
|
|||
};
|
||||
|
||||
new WebpackDevServer(webpack(config), {
|
||||
contentBase: 'www',
|
||||
publicPath: config.output.publicPath,
|
||||
historyApiFallback: false,
|
||||
hot: true,
|
||||
|
|
|
@ -2,20 +2,19 @@ const path = require('path');
|
|||
const webpack = require('webpack');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const devServer = 'http://0.0.0.0:8080';
|
||||
|
||||
module.exports = {
|
||||
context: __dirname,
|
||||
devtool: '#eval-source-map',
|
||||
entry: [
|
||||
'webpack-dev-server/client?' + devServer,
|
||||
'webpack-dev-server/client?http://0.0.0.0:8080',
|
||||
'webpack/hot/only-dev-server',
|
||||
'./app/app.jsx'
|
||||
],
|
||||
output: {
|
||||
path: path.join(__dirname, 'build'),
|
||||
filename: 'docs.js',
|
||||
publicPath: '/build/'
|
||||
publicPath: '/'
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['', '.jsx', '.scss', '.js', '.json'],
|
|
@ -0,0 +1,61 @@
|
|||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const TransferWebpackPlugin = require('transfer-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
context: __dirname,
|
||||
devtool: '#eval-source-map',
|
||||
entry: ['./app/app.jsx'],
|
||||
output: {
|
||||
path: path.join(__dirname, 'build'),
|
||||
filename: 'docs.js'
|
||||
},
|
||||
devServer: {
|
||||
contentBase: '/build'
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['', '.jsx', '.scss', '.js', '.json'],
|
||||
alias: {
|
||||
'react-toolbox': path.resolve(__dirname + './../components')
|
||||
},
|
||||
modulesDirectories: [
|
||||
'node_modules',
|
||||
path.resolve(__dirname, './node_modules'),
|
||||
path.resolve(__dirname, './../node_modules'),
|
||||
path.resolve(__dirname, './../components')
|
||||
]
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /(\.js|\.jsx)$/,
|
||||
exclude: /(node_modules)/,
|
||||
loader: 'react-hot!babel'
|
||||
}, {
|
||||
test: /(\.scss|\.css)$/,
|
||||
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass')
|
||||
}, {
|
||||
test: /(\.txt)$/,
|
||||
loader: 'raw',
|
||||
include: path.resolve(__dirname, './app/examples')
|
||||
}
|
||||
]
|
||||
},
|
||||
postcss: [autoprefixer],
|
||||
plugins: [
|
||||
new ExtractTextPlugin('docs.css', {allChunks: true}),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress: { warnings: false }
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
inject: false,
|
||||
template: path.resolve(__dirname, './www/index.html')
|
||||
}),
|
||||
new TransferWebpackPlugin([
|
||||
{ from: 'www/images', to: 'images' }
|
||||
], path.resolve(__dirname, './'))
|
||||
]
|
||||
};
|
Binary file not shown.
After Width: | Height: | Size: 256 KiB |
|
@ -13,11 +13,11 @@
|
|||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="HandheldFriendly" content="True">
|
||||
<meta http-equiv="cleartype" content="on">
|
||||
<link rel="stylesheet" href="/build/docs.css">
|
||||
<link rel="stylesheet" href="/docs.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="/build/docs.js"></script>
|
||||
<script src="/docs.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue