hubl/webpack.config.js

77 lines
2.0 KiB
JavaScript

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const config = {
entry: {
app: './src/scripts/index.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: "[name].bundle.js",
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.pug'
}),
new MiniCssExtractPlugin({
filename: "style.css"
})
],
module: {
rules: [
{
test: /\.pug$/,
use: [
{ loader: "html-loader" },
{ loader: "pug-html-loader",
options: {
data: {
cdn: "https://cdn.happy-dev.fr",
xmpp: "https://jabber.happy-dev.fr/http-bind/",
authority: "http://127.0.0.1:8000/openid/",
endpoints: {
businessproviders: "http://127.0.0.1:8000/businessproviders/",
circles: "http://127.0.0.1:8000/circles/",
groups: "http://127.0.0.1:8000/groups/",
joboffers: "http://127.0.0.1:8000/job-offers/",
projects: "http://127.0.0.1:8000/projects/",
skills: "http://127.0.0.1:8000/skills/",
users: "http://127.0.0.1:8000/users/"
}
}
}
}
]
},
{
test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader"
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { url: false, sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } }
]
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: 'file-loader'
},
{
test: /\.(eot|ttf|woff|woff2)$/,
loader: 'file-loader',
}
]
}
};
module.exports = (env, argv) => {
if (argv.mode === 'development') {}
if (argv.mode === 'production') {}
return config;
}