Last active
March 30, 2017 13:29
-
-
Save Razzwan/9d8177d0ad9282806a43471ecee1c78f to your computer and use it in GitHub Desktop.
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
const { resolve } = require('path') | |
const webpack = require('webpack') | |
const Package = require(resolve(__dirname, '..', 'package')) | |
const config = require(resolve(__dirname, '..', 'app/config/config.json')) | |
module.exports = { | |
name: Package.name, | |
context: resolve(__dirname, '..', 'app'), | |
target: 'web', | |
output: { | |
path: config.env === 'dev' ? resolve(__dirname, '..', 'dist') : config.publicPath, | |
filename: 'static/js/[name].[hash:8].js', | |
chunkFilename: 'static/js/[name].[hash:8].chunk.js', | |
publicPath: '/', | |
pathinfo: true, | |
}, | |
resolve: { | |
extensions: ['.js', '.json', '.md'], | |
alias: { | |
components: resolve(__dirname, '..', 'app/components'), | |
styles: resolve(__dirname, '..', 'app/components/styles'), | |
config: resolve(__dirname, '..', 'app/config'), | |
data: resolve(__dirname, '..', 'app/data'), | |
store: resolve(__dirname, '..', 'app/store'), | |
helpers: resolve(__dirname, '..', 'app/helpers'), | |
static: resolve(__dirname, '..', 'static'), | |
initial_data: config.env === 'dev' ? resolve(__dirname, '..', 'app/data/mock') : config.initial_data_base_dir, | |
}, | |
modules: [ | |
'node_modules', | |
], | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.(js|jsx)?$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', | |
}, | |
{ | |
test: /\.json$/, | |
use: 'json-loader' | |
}, | |
{ | |
test: /\.md$/, | |
use: [ | |
{ | |
loader: "html-loader" | |
}, | |
] | |
}, | |
{ | |
test: /\.(jpe?g|png|gif|svg)$/i, | |
use: [ | |
{ | |
loader: 'file-loader', | |
options: { | |
digest: 'hex', | |
name: 'static/media/[name].[hash:8].[ext]', | |
} | |
}, | |
] | |
}, | |
{ | |
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, | |
loader: 'file-loader', | |
options: { | |
limit: 10000, | |
minetype: 'application/font-woff', | |
name: 'static/fonts/[name].[hash:8].[ext]', | |
}, | |
}, | |
{ | |
test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/, | |
loader: 'file-loader', | |
options: { | |
name: 'static/fonts/[name].[hash:8].[ext]', | |
} | |
}, | |
], | |
}, | |
plugins: [ | |
], | |
node: { | |
fs: 'empty', | |
net: 'empty', | |
tls: 'empty' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment