Skip to content

Instantly share code, notes, and snippets.

@SPY
Created April 10, 2016 16:38
Show Gist options
  • Save SPY/445d721bab6985c639c16d436f67f778 to your computer and use it in GitHub Desktop.
Save SPY/445d721bab6985c639c16d436f67f778 to your computer and use it in GitHub Desktop.
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var ExtendedDefinePlugin = require('extended-define-webpack-plugin')
var path = require('path')
module.exports = {
entry: './src/index.tsx',
resolve: {
alias: {
src: path.join(__dirname, 'src'),
store: path.join(__dirname, 'src', 'store'),
chart: path.join(__dirname, 'src', 'chart'),
components: path.join(__dirname, 'src', 'components'),
services: path.join(__dirname, 'src', 'services'),
actions: path.join(__dirname, 'src', 'actions'),
utils: path.join(__dirname, 'src', 'utils'),
reducers: path.join(__dirname, 'src', 'reducers'),
localization: path.join(__dirname, 'src', 'localization'),
images: path.join(__dirname, 'src', 'images'),
less: path.join(__dirname, 'src', 'less')
},
extensions: ['', '.ts', '.tsx', '.webpack.js', '.web.js', '.js']
},
output: {
path: './build/',
filename: 'bundle.js',
publicPath: '/mobile/'
},
// Source maps support (or 'inline-source-map' also works)
devtool: 'source-map',
module: {
loaders: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader'
},
{
test: /\.css/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
},
{
test: /\.(png|gif)$/,
loader: 'file-loader?name=[sha512:hash:base36:7].[ext]'
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/font-woff"
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/font-woff"
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/octet-stream"
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file"
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=image/svg+xml"
}
]
},
plugins: [
new ExtractTextPlugin("styles.css", {
allChunks: true
}),
new ExtendedDefinePlugin({
'process.env.NODE_ENV': 'production'
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment