136 lines
3.4 KiB
CoffeeScript
136 lines
3.4 KiB
CoffeeScript
'use strict'
|
|
path = require('path')
|
|
webpack = require('webpack')
|
|
autoprefixer = require('autoprefixer')
|
|
|
|
module.exports =
|
|
debug: true
|
|
resolve:
|
|
root: __dirname
|
|
modulesDirectories: [ 'node_modules' ]
|
|
extensions: [
|
|
''
|
|
'.cjsx'
|
|
'.coffee'
|
|
'.jsx'
|
|
'.js'
|
|
]
|
|
alias:
|
|
underscore: 'lodash'
|
|
source: path.join(__dirname, '/src/main')
|
|
entry:
|
|
main: [
|
|
'webpack-hot-middleware/client'
|
|
'source/cjsx/main'
|
|
],
|
|
vendor: [
|
|
'normalize.css/normalize.css'
|
|
'es5-shim'
|
|
'es5-shim/es5-sham'
|
|
'es6-shim'
|
|
'es6-shim/es6-sham'
|
|
'json3'
|
|
'html5shiv'
|
|
'html5shiv/dist/html5shiv-printshiv'
|
|
]
|
|
output:
|
|
path: path.join(__dirname, './assets')
|
|
filename: '[name].js'
|
|
publicPath: '/assets/'
|
|
pathinfo: true
|
|
devtool: 'eval'
|
|
plugins: [
|
|
new (webpack.PrefetchPlugin)("react")
|
|
new (webpack.PrefetchPlugin)("react/lib/ReactComponentBrowserEnvironment")
|
|
new (webpack.HotModuleReplacementPlugin)
|
|
new (webpack.NoErrorsPlugin)
|
|
new (webpack.ProvidePlugin)(
|
|
'window.Tether': 'tether'
|
|
)
|
|
# new (webpack.optimize.CommonsChunkPlugin)(
|
|
# name: 'vendor',
|
|
# chunks: ['vensor'],
|
|
# filename: 'vendor.js',
|
|
# minChunks: Infinity
|
|
# )
|
|
]
|
|
module:
|
|
preLoaders: [
|
|
test: /\.(js|jsx)$/
|
|
loader: 'eslint'
|
|
exclude: /node_modules/
|
|
]
|
|
loaders: [
|
|
test: /\.(js|jsx)?$/
|
|
exclude: /(node_modules|bower_components)/
|
|
loader: [
|
|
'react-hot'
|
|
'babel'
|
|
]#'babel-loader' is also a legal name to reference
|
|
query:
|
|
presets: ['es2015']
|
|
plugins: ['transform-runtime']
|
|
,
|
|
test: /\.cjsx$/
|
|
loaders: [
|
|
'react-hot'
|
|
'coffee'
|
|
'cjsx'
|
|
]#'babel-loader' is also a legal name to reference
|
|
,
|
|
test: /\.coffee$/
|
|
loaders: [
|
|
'react-hot'
|
|
'coffee'
|
|
]#'babel-loader' is also a legal name to reference
|
|
,
|
|
test: /\.scss$/
|
|
loaders: [
|
|
'style'
|
|
'css'
|
|
'postcss'
|
|
'sass'
|
|
]
|
|
,
|
|
test: /\.css$/
|
|
exclude: /.*\.min.css/
|
|
loaders: [
|
|
'style'
|
|
'css'
|
|
'postcss'
|
|
]
|
|
,
|
|
test: /\.png$/
|
|
loader: 'url?limit=8192&mimetype=image/png'
|
|
,
|
|
test: /\.jpe?g$/
|
|
loader: 'url?limit=8192&mimetype=image/jpg'
|
|
,
|
|
test: /\.gif$/
|
|
loader: 'url?limit=8192&mimetype=image/gif'
|
|
,
|
|
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/
|
|
loader: 'url?limit=8192&mimetype=image/svg+xml'
|
|
,
|
|
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/
|
|
loader: 'url?limit=8192&mimetype=application/font-woff2'
|
|
,
|
|
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/
|
|
loader: 'url?limit=8192&mimetype=application/font-woff'
|
|
,
|
|
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/
|
|
loader: 'url?limit=8192&mimetype=application/octet-stream'
|
|
,
|
|
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/
|
|
loader: 'file'
|
|
]
|
|
postcss: [ autoprefixer ]
|
|
eslint:
|
|
emitErrors: true
|
|
reporter: (results) ->
|
|
results.map((result) ->
|
|
result.messages.map((msg) ->
|
|
' ' + msg.message + '(' + msg.ruleId + ')' + ' @ line ' + msg.line + ' column ' + msg.column + ' - ' + (if msg.fatal then 'fatal, ' else '') + 'severity: ' + msg.severity
|
|
).join '\n'
|
|
).join '\n'
|