1
Fork 0
mirror of https://github.com/Steffo99/unisteffo.git synced 2024-11-29 11:24:18 +00:00
triennale-appunti-steffo/preact.config.js

75 lines
2 KiB
JavaScript
Raw Normal View History

2020-05-28 01:08:26 +00:00
import SentryCliPlugin from "@sentry/webpack-plugin";
2020-08-21 16:33:22 +00:00
2020-05-28 01:08:26 +00:00
const DefinePlugin = require("webpack/lib/DefinePlugin");
2020-06-29 13:45:09 +00:00
const ProvidePlugin = require("webpack/lib/ProvidePlugin");
2020-05-28 01:08:26 +00:00
2020-03-01 20:25:46 +00:00
export default function (config, env, helpers) {
// noinspection JSUnresolvedVariable
config.resolve.alias["react"] = "preact/compat";
// noinspection JSUnresolvedVariable
config.resolve.alias["react-dom"] = "preact/compat";
2020-06-29 13:45:09 +00:00
// noinspection JSUnresolvedVariable
config.resolve.alias["path"] = "path-browserify";
2020-03-01 20:25:46 +00:00
config.module.rules.push(
{
test: /\.nojekyll$/,
loader: 'file-loader',
options: {
name: '.nojekyll'
}
}
);
config.module.rules.push(
{
test: /CNAME$/,
loader: 'file-loader',
options: {
name: 'CNAME'
}
}
);
2020-06-29 13:45:09 +00:00
config.module.rules.push(
{
test: /favicon\.ico$/,
loader: 'file-loader',
options: {
name: 'favicon.ico'
}
}
);
2020-05-28 01:08:26 +00:00
config.plugins.push(
2020-05-28 12:53:38 +00:00
new DefinePlugin({"process.env.RELEASE": `"${process.env.npm_package_version}"`})
2020-05-28 01:08:26 +00:00
);
2020-06-29 13:45:09 +00:00
config.plugins.push(
new ProvidePlugin({"process": "process/browser"})
);
2020-08-21 16:33:22 +00:00
if (env.production) {
2021-02-02 03:08:22 +00:00
config.plugins[17].patterns.shift();
config.plugins[17].patterns.shift();
config.plugins[17].patterns.push({
2020-09-12 02:10:59 +00:00
from: "assets",
to: ""
});
2020-05-28 01:08:26 +00:00
config.plugins.push(
new SentryCliPlugin({
2020-05-28 14:27:17 +00:00
include: './docs',
2020-05-28 13:28:42 +00:00
ignoreFile: ".gitignore",
2020-05-28 01:08:26 +00:00
configFile: '.sentryclirc',
2020-05-28 12:53:38 +00:00
release: process.env.npm_package_version,
2020-05-28 01:08:26 +00:00
})
)
}
2020-08-21 23:57:29 +00:00
// https://github.com/preactjs/preact-cli/issues/710
let critters = helpers.getPluginsByName(config, 'Critters')[0];
if (critters) {
critters.plugin.options.preload = 'js' // or some other option
}
2020-03-01 20:25:46 +00:00
};