mon-entreprise/source/webpack.common.js

108 lines
2.7 KiB
JavaScript
Raw Normal View History

/* eslint-env node */
2018-07-05 09:54:41 +00:00
const HTMLPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
const path = require('path')
2016-06-29 10:27:04 +00:00
module.exports = {
resolve: {
alias: {
Engine: path.resolve('source/engine/'),
Règles: path.resolve('source/règles/'),
2018-07-12 08:09:41 +00:00
Actions: path.resolve('source/actions/'),
Ui: path.resolve('source/components/ui/'),
2017-12-11 14:42:03 +00:00
Components: path.resolve('source/components/'),
Selectors: path.resolve('source/selectors/'),
2018-07-12 08:09:41 +00:00
Reducers: path.resolve('source/reducers/'),
2018-08-04 10:20:08 +00:00
Types: path.resolve('source/types/'),
Images: path.resolve('source/images/')
}
},
2018-07-12 08:09:41 +00:00
entry: {
infrance: ['./source/sites/mycompanyinfrance.fr/entry.js'],
embauche: ['./source/sites/embauche.gouv.fr/entry.js'],
2018-08-04 10:20:08 +00:00
// To not introduce breaking into the iframe integration, we serve simulateur.js from a 'dist' subdirectory
'dist/simulateur': ['./source/sites/embauche.gouv.fr/iframe-script.js']
2018-07-12 08:09:41 +00:00
},
output: {
path: path.resolve('./dist/'),
2018-08-04 10:20:08 +00:00
filename: ({ chunk }) =>
chunk.name === 'dist/simulateur' ? '[name].js' : '[name].[hash].js'
},
2016-06-29 10:27:04 +00:00
module: {
2018-03-01 19:30:57 +00:00
rules: [
{
test: /\.css$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
sourceMap: true,
importLoaders: 1
}
},
{
loader: 'postcss-loader'
2017-03-14 14:00:54 +00:00
}
]
},
{
test: /\.(jpe?g|png|svg)$/,
use: {
loader: 'file-loader',
options: {
name: 'images/[name].[ext]'
}
}
},
{
test: /\.yaml$/,
loader: 'json-loader!yaml-loader'
},
{
test: /\.js$/,
exclude: /node_modules|dist/,
loader: 'babel-loader'
},
{
test: /\.csv$/,
loader: 'csv-loader',
options: {
dynamicTyping: true,
header: true,
skipEmptyLines: true
2017-03-14 14:00:54 +00:00
}
},
{
test: /\.ne$/,
loader: 'babel-loader!nearley-loader'
}
]
},
plugins: [
2018-07-05 09:54:41 +00:00
new HTMLPlugin({
template: 'index.html',
2018-07-17 15:36:27 +00:00
chunks: ['infrance'],
2018-08-09 15:01:31 +00:00
title: 'My company in France 🇫🇷',
2018-08-04 10:20:08 +00:00
description:
2018-08-09 15:01:31 +00:00
'The easy and official guide to help you start your business in France. From registering your company to hiring your first employee.',
2018-07-17 15:36:27 +00:00
filename: 'infrance.html'
2018-07-12 08:09:41 +00:00
}),
new HTMLPlugin({
template: 'index.html',
2018-07-17 15:36:27 +00:00
chunks: ['embauche'],
2018-08-04 10:20:08 +00:00
title: "Simulateur d'embauche 🤝",
description:
"Simulation du prix d'une embauche en France et calcul du salaire net à partir du brut : CDD, statut cadre, cotisations sociales, retraite...",
filename: 'embauche.html'
2018-07-05 09:54:41 +00:00
}),
2018-08-04 10:20:08 +00:00
new CopyPlugin([
'./manifest.webmanifest',
'./source/sites/embauche.gouv.fr/images/logo',
2018-09-07 09:58:09 +00:00
{ from: './source/sites/embauche.gouv.fr/robots.txt', to: 'robots.embauche.txt' },
{ from: './source/sites/mycompanyinfrance.fr/robots.txt', to: 'robots.infrance.txt' },
2018-08-04 10:20:08 +00:00
])
]
2016-06-29 10:27:04 +00:00
}