2018-07-04 17:45:43 +00:00
|
|
|
/* eslint-env node */
|
|
|
|
const WorkboxPlugin = require('workbox-webpack-plugin')
|
2018-07-05 09:54:41 +00:00
|
|
|
const HTMLPlugin = require('html-webpack-plugin')
|
|
|
|
const CopyPlugin = require('copy-webpack-plugin')
|
2018-07-04 17:45:43 +00:00
|
|
|
const path = require('path')
|
2016-06-29 10:27:04 +00:00
|
|
|
module.exports = {
|
2017-05-10 14:09:36 +00:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
Engine: path.resolve('source/engine/'),
|
2018-01-19 10:57:45 +00:00
|
|
|
Règles: path.resolve('source/règles/'),
|
2017-12-11 14:42:03 +00:00
|
|
|
Components: path.resolve('source/components/'),
|
2018-06-06 16:17:13 +00:00
|
|
|
Images: path.resolve('source/images/'),
|
|
|
|
Selectors: path.resolve('source/selectors/')
|
2017-05-10 14:09:36 +00:00
|
|
|
}
|
|
|
|
},
|
2018-03-01 18:39:36 +00:00
|
|
|
output: {
|
|
|
|
path: path.resolve('./dist/'),
|
2018-07-05 09:54:41 +00:00
|
|
|
filename: '[name]_[chunk-hash].js'
|
2018-03-01 18:39:36 +00:00
|
|
|
},
|
2016-06-29 10:27:04 +00:00
|
|
|
module: {
|
2018-03-01 19:30:57 +00:00
|
|
|
rules: [
|
2018-01-03 15:54:19 +00:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'style-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
importLoaders: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2018-01-19 11:29:43 +00:00
|
|
|
loader: 'postcss-loader'
|
2017-03-14 14:00:54 +00:00
|
|
|
}
|
2018-01-03 15:54:19 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
loader: 'html-loader'
|
|
|
|
},
|
2018-02-05 17:17:56 +00:00
|
|
|
{
|
|
|
|
test: /\.(jpe?g|png|svg)$/,
|
|
|
|
use: {
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: 'images/[name].[ext]'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-01-03 15:54:19 +00:00
|
|
|
{
|
|
|
|
test: /\.yaml$/,
|
|
|
|
loader: 'json-loader!yaml-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
2018-04-27 13:51:31 +00:00
|
|
|
exclude: /node_modules|dist/,
|
2018-01-03 15:54:19 +00:00
|
|
|
loader: 'babel-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.csv$/,
|
|
|
|
loader: 'csv-loader',
|
|
|
|
options: {
|
|
|
|
dynamicTyping: true,
|
|
|
|
header: true,
|
|
|
|
skipEmptyLines: true
|
2017-03-14 14:00:54 +00:00
|
|
|
}
|
2018-01-03 15:54:19 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.ne$/,
|
|
|
|
loader: 'babel-loader!nearley-loader'
|
2017-09-19 14:55:23 +00:00
|
|
|
}
|
2018-01-03 15:54:19 +00:00
|
|
|
]
|
2018-07-04 17:45:43 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
2018-07-05 09:54:41 +00:00
|
|
|
new HTMLPlugin({
|
|
|
|
template: 'index.html',
|
|
|
|
chunks: ['bundle']
|
|
|
|
}),
|
|
|
|
new HTMLPlugin({
|
|
|
|
template: 'couleur.html',
|
|
|
|
chunks: ['colour-chooser'],
|
|
|
|
filename: 'couleur.html'
|
|
|
|
}),
|
|
|
|
new CopyPlugin(['./manifest.webmanifest', './source/images/logo']),
|
2018-07-04 17:45:43 +00:00
|
|
|
new WorkboxPlugin.GenerateSW({
|
|
|
|
clientsClaim: true,
|
|
|
|
skipWaiting: true,
|
2018-07-05 09:54:41 +00:00
|
|
|
// chunks: ['bundle'],
|
2018-07-04 17:45:43 +00:00
|
|
|
swDest: 'sw.js',
|
2018-07-05 09:54:41 +00:00
|
|
|
navigateFallback: '/index.html',
|
2018-07-04 17:45:43 +00:00
|
|
|
runtimeCaching: [
|
|
|
|
{
|
|
|
|
urlPattern: new RegExp(
|
2018-07-04 17:46:20 +00:00
|
|
|
'https://fonts.(?:googleapis|gstatic).com/(.*)|https://cdn.polyfill.io/v2/polyfill.min.js'
|
2018-07-04 17:45:43 +00:00
|
|
|
),
|
|
|
|
handler: 'cacheFirst',
|
|
|
|
options: {
|
|
|
|
cacheName: 'google-fonts',
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 5
|
|
|
|
},
|
|
|
|
cacheableResponse: {
|
|
|
|
statuses: [0, 200]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
]
|
2016-06-29 10:27:04 +00:00
|
|
|
}
|