mirror of
https://github.com/Steffo99/unisteffo.git
synced 2024-11-24 08:54:21 +00:00
74 lines
2 KiB
JavaScript
74 lines
2 KiB
JavaScript
import SentryCliPlugin from "@sentry/webpack-plugin";
|
|
|
|
const DefinePlugin = require("webpack/lib/DefinePlugin");
|
|
const ProvidePlugin = require("webpack/lib/ProvidePlugin");
|
|
|
|
|
|
export default function (config, env, helpers) {
|
|
// noinspection JSUnresolvedVariable
|
|
config.resolve.alias["react"] = "preact/compat";
|
|
// noinspection JSUnresolvedVariable
|
|
config.resolve.alias["react-dom"] = "preact/compat";
|
|
// noinspection JSUnresolvedVariable
|
|
config.resolve.alias["path"] = "path-browserify";
|
|
|
|
config.module.rules.push(
|
|
{
|
|
test: /\.nojekyll$/,
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: '.nojekyll'
|
|
}
|
|
}
|
|
);
|
|
config.module.rules.push(
|
|
{
|
|
test: /CNAME$/,
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: 'CNAME'
|
|
}
|
|
}
|
|
);
|
|
config.module.rules.push(
|
|
{
|
|
test: /favicon\.ico$/,
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: 'favicon.ico'
|
|
}
|
|
}
|
|
);
|
|
|
|
config.plugins.push(
|
|
new DefinePlugin({"process.env.RELEASE": `"${process.env.npm_package_version}"`})
|
|
);
|
|
|
|
config.plugins.push(
|
|
new ProvidePlugin({"process": "process/browser"})
|
|
);
|
|
|
|
if (env.production) {
|
|
config.plugins[17].patterns.shift();
|
|
config.plugins[17].patterns.shift();
|
|
config.plugins[17].patterns.push({
|
|
from: "assets",
|
|
to: ""
|
|
});
|
|
|
|
config.plugins.push(
|
|
new SentryCliPlugin({
|
|
include: './docs',
|
|
ignoreFile: ".gitignore",
|
|
configFile: '.sentryclirc',
|
|
release: process.env.npm_package_version,
|
|
})
|
|
)
|
|
}
|
|
|
|
// 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
|
|
}
|
|
};
|