kana/webpack.config.prod.js

74 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-11-16 23:19:55 +00:00
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const path = require('path');
module.exports = {
context: __dirname,
output: {
path: path.resolve(__dirname, './dist'),
publicPath: './dist/',
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.jsx']
},
plugins: [
new SWPrecacheWebpackPlugin( {
cacheId: 'kana-quiz',
filename: 'sw.js',
stripPrefix: '/home/anzz/code/kanaquiz/',
maximumFileSizeToCacheInBytes: 4194304,
minify: true,
2018-12-29 10:46:31 +00:00
runtimeCaching: [
{
handler: 'fastest',
urlPattern: /\.(woff2|svg|ttf|eot|woff)$/,
},
{
handler: 'networkFirst',
urlPattern: /\.html$/
}
],
2018-11-16 23:19:55 +00:00
})
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.scss$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
importLoaders: 1
}
},
{
loader: 'postcss-loader'
}
]
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/,
loader: 'url-loader?limit=25000'
},
{
test: /\.(eot|ttf)$/,
loader: 'file-loader'
}
]
}
};