🐛 répare le tracking matomo
parent
506402c3c0
commit
9c93ae8726
|
@ -243,9 +243,8 @@
|
|||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Matomo : track only production code-->
|
||||
<% if (htmlWebpackPlugin.production) { %>
|
||||
<% if (htmlWebpackPlugin.options.injectTrackingScript) { %>
|
||||
<script type="text/javascript">
|
||||
var _paq = window._paq || []
|
||||
_paq.push([
|
||||
|
|
|
@ -4,13 +4,7 @@ const CopyPlugin = require('copy-webpack-plugin')
|
|||
const { EnvironmentPlugin } = require('webpack')
|
||||
const path = require('path')
|
||||
|
||||
const HTMLPluginCommonParams = {
|
||||
template: 'index.html',
|
||||
inject: false,
|
||||
production: process.env.NODE_ENV === 'production'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
module.exports.default = {
|
||||
resolve: {
|
||||
alias: {
|
||||
Engine: path.resolve('source/engine/'),
|
||||
|
@ -39,26 +33,6 @@ module.exports = {
|
|||
FR_SITE: '/mon-entreprise${path}',
|
||||
MASTER: false
|
||||
}),
|
||||
new HTMLPlugin({
|
||||
...HTMLPluginCommonParams,
|
||||
chunks: ['infrance'],
|
||||
title:
|
||||
'My company in France: A step-by-step guide to start a business in France',
|
||||
description:
|
||||
'Find the type of company that suits you and follow the steps to register your company. Discover the French social security system by simulating your hiring costs. Discover the procedures to hire in France and learn the basics of French labour law.',
|
||||
filename: 'infrance.html',
|
||||
logo: 'https://mon-entreprise.fr/images/logo-mycompany-share.png'
|
||||
}),
|
||||
new HTMLPlugin({
|
||||
...HTMLPluginCommonParams,
|
||||
chunks: ['mon-entreprise'],
|
||||
title:
|
||||
"Mon-entreprise.fr : L'assistant officiel du créateur d'entreprise",
|
||||
description:
|
||||
'Du statut juridique à la première embauche, en passant par la simulation des cotisations, vous trouverez ici toutes les ressources pour démarrer votre activité.',
|
||||
filename: 'mon-entreprise.html',
|
||||
logo: 'https://mon-entreprise.fr/images/logo-share.png'
|
||||
}),
|
||||
|
||||
new CopyPlugin([
|
||||
'./manifest.webmanifest',
|
||||
|
@ -85,3 +59,94 @@ module.exports = {
|
|||
])
|
||||
]
|
||||
}
|
||||
|
||||
module.exports.styleLoader = styleLoader => ({
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
{ loader: styleLoader },
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
importLoaders: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
module.exports.commonLoaders = ({ legacy = false } = {}) => {
|
||||
const babelLoader = {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: !legacy
|
||||
? {
|
||||
esmodules: true
|
||||
}
|
||||
: {
|
||||
esmodules: false,
|
||||
browsers: ['ie 11']
|
||||
},
|
||||
useBuiltIns: 'entry'
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
{ test: /\.js$/, loader: babelLoader, exclude: /node_modules|dist/ },
|
||||
{
|
||||
test: /\.(jpe?g|png|svg)$/,
|
||||
use: {
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'images/[name].[ext]'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.yaml$/,
|
||||
use: ['json-loader', 'yaml-loader']
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.ne$/,
|
||||
use: [babelLoader, 'nearley-loader']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
module.exports.HTMLPlugins = ({ injectTrackingScript = false } = {}) => [
|
||||
new HTMLPlugin({
|
||||
template: 'index.html',
|
||||
inject: false,
|
||||
injectTrackingScript,
|
||||
// mycompanyinfrance.fr :
|
||||
chunks: ['infrance'],
|
||||
title:
|
||||
'My company in France: A step-by-step guide to start a business in France',
|
||||
description:
|
||||
'Find the type of company that suits you and follow the steps to register your company. Discover the French social security system by simulating your hiring costs. Discover the procedures to hire in France and learn the basics of French labour law.',
|
||||
filename: 'infrance.html',
|
||||
logo: 'https://mon-entreprise.fr/images/logo-mycompany-share.png'
|
||||
}),
|
||||
new HTMLPlugin({
|
||||
template: 'index.html',
|
||||
inject: false,
|
||||
injectTrackingScript,
|
||||
// mon-entreprise.fr :
|
||||
chunks: ['mon-entreprise'],
|
||||
title: "Mon-entreprise.fr : L'assistant officiel du créateur d'entreprise",
|
||||
description:
|
||||
'Du statut juridique à la première embauche, en passant par la simulation des cotisations, vous trouverez ici toutes les ressources pour démarrer votre activité.',
|
||||
filename: 'mon-entreprise.html',
|
||||
logo: 'https://mon-entreprise.fr/images/logo-share.png'
|
||||
})
|
||||
]
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
module.exports.styleLoader = styleLoader => ({
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
{ loader: styleLoader },
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
importLoaders: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
module.exports.commonLoaders = ({ legacy = false } = {}) => {
|
||||
const babelLoader = {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: !legacy
|
||||
? {
|
||||
esmodules: true
|
||||
}
|
||||
: {
|
||||
esmodules: false,
|
||||
browsers: ['ie 11']
|
||||
},
|
||||
useBuiltIns: 'entry'
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
{ test: /\.js$/, loader: babelLoader, exclude: /node_modules|dist/ },
|
||||
{
|
||||
test: /\.(jpe?g|png|svg)$/,
|
||||
use: {
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'images/[name].[ext]'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.yaml$/,
|
||||
use: ['json-loader', 'yaml-loader']
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.ne$/,
|
||||
use: [babelLoader, 'nearley-loader']
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,7 +1,11 @@
|
|||
const { map } = require('ramda')
|
||||
const webpack = require('webpack')
|
||||
const common = require('./webpack.common.js')
|
||||
const { commonLoaders, styleLoader } = require('./webpack.commonLoaders')
|
||||
const {
|
||||
commonLoaders,
|
||||
styleLoader,
|
||||
HTMLPlugins,
|
||||
default: common
|
||||
} = require('./webpack.common.js')
|
||||
|
||||
module.exports = {
|
||||
...common,
|
||||
|
@ -12,6 +16,7 @@ module.exports = {
|
|||
entry: map(entry => ['webpack-hot-middleware/client', entry], common.entry),
|
||||
plugins: [
|
||||
...common.plugins,
|
||||
...HTMLPlugins(),
|
||||
new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
|
||||
new webpack.HotModuleReplacementPlugin()
|
||||
]
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
const common = require('./webpack.common.js')
|
||||
const path = require('path')
|
||||
const { commonLoaders, styleLoader } = require('./webpack.commonLoaders')
|
||||
const {
|
||||
default: common,
|
||||
commonLoaders,
|
||||
styleLoader
|
||||
} = require('./webpack.common')
|
||||
|
||||
module.exports = {
|
||||
resolve: common.resolve,
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
const common = require('./webpack.common.js')
|
||||
const {
|
||||
commonLoaders,
|
||||
styleLoader,
|
||||
HTMLPlugins,
|
||||
default: common
|
||||
} = require('./webpack.common.js')
|
||||
|
||||
const PrerenderSPAPlugin = require('prerender-spa-plugin')
|
||||
const WorkboxPlugin = require('workbox-webpack-plugin')
|
||||
|
||||
|
@ -6,7 +12,6 @@ const Renderer = PrerenderSPAPlugin.PuppeteerRenderer
|
|||
const path = require('path')
|
||||
const cheerio = require('cheerio')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const { commonLoaders, styleLoader } = require('./webpack.commonLoaders')
|
||||
|
||||
const prerenderConfig = () => ({
|
||||
staticDir: path.resolve('dist'),
|
||||
|
@ -57,6 +62,7 @@ module.exports = {
|
|||
devtool: 'source-map',
|
||||
plugins: [
|
||||
...common.plugins,
|
||||
...HTMLPlugins({ injectTrackingScript: true }),
|
||||
new WorkboxPlugin.GenerateSW({
|
||||
clientsClaim: true,
|
||||
skipWaiting: true,
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
const { map } = require('ramda')
|
||||
const prod = require('./webpack.prod.js')
|
||||
const { commonLoaders, styleLoader } = require('./webpack.commonLoaders')
|
||||
const {
|
||||
commonLoaders,
|
||||
styleLoader,
|
||||
HTMLPlugins
|
||||
} = require('./webpack.common.js')
|
||||
|
||||
const { EnvironmentPlugin } = require('webpack')
|
||||
|
||||
module.exports = {
|
||||
|
@ -13,6 +18,7 @@ module.exports = {
|
|||
rules: [...commonLoaders({ legacy: true }), styleLoader('style-loader')]
|
||||
},
|
||||
plugins: [
|
||||
...HTMLPlugins({ injectTrackingScript: true }),
|
||||
new EnvironmentPlugin({
|
||||
EN_SITE: '/infrance${path}',
|
||||
FR_SITE: '/mon-entreprise${path}'
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
var webpack = require('webpack'),
|
||||
common = require('./webpack.common.js'),
|
||||
{ commonLoaders, styleLoader } = require('./webpack.commonLoaders')
|
||||
const webpack = require('webpack')
|
||||
const {
|
||||
default: common,
|
||||
commonLoaders,
|
||||
styleLoader
|
||||
} = require('./webpack.common')
|
||||
|
||||
module.exports = {
|
||||
...common,
|
||||
|
|
Loading…
Reference in New Issue