Release v0.2.0 #5

Merged
ksv741 merged 13 commits from krylov into main 2024-04-04 06:13:56 +03:00
2 changed files with 24 additions and 0 deletions
Showing only changes of commit 83e421d63a - Show all commits

View File

@ -1,5 +1,6 @@
import type webpack from 'webpack';
import type { WebpackOptions } from 'types';
import getProvidePlugin from './provide-plugin';
import getBundleAnalyzerPlugin from './bundle-analyzer-plugin';
import getCopyPlugin from './copy-plugin';
import getDefinePlugin from './define-plugin';
@ -20,6 +21,7 @@ const createPlugins = (options: WebpackOptions): webpack.Configuration['plugins'
const developmentPlugins = [
getHtmlPlugin(options),
getProgressPlugin(options),
getProvidePlugin(options),
getDefinePlugin(options),
getForkTsCheckerPlugin(options),
getEslintPlugin(options),
@ -29,6 +31,7 @@ const createPlugins = (options: WebpackOptions): webpack.Configuration['plugins'
const productionPlugins = [
getHtmlPlugin(options),
getProvidePlugin(options),
getDefinePlugin(options),
getMiniCssPlugin(options),
getForkTsCheckerPlugin(options),

View File

@ -0,0 +1,21 @@
import type { WebpackOptions } from 'types';
import { ProvidePlugin } from 'webpack';
const getProvidePlugin = (options: WebpackOptions) => {
const {
plugins: {
providePlugin,
} = {},
} = options;
if (providePlugin === 'off') {
return null;
}
return new ProvidePlugin({
process: 'process/browser',
...providePlugin,
});
};
export default getProvidePlugin;