Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- next-plugins/next-ts-checker.js
- /* eslint-disable @typescript-eslint/no-var-requires */
- const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
- /**
- * Next-плагин для подключение вывода TS ошибок в консоль в dev режиме
- * @see https://github.com/cyrilwanner/next-compose-plugins#phases
- * @see https://github.com/vercel/next.js/pull/13428#issuecomment-655193665
- */
- module.exports = (nextConfig = {}) => {
- return Object.assign({}, nextConfig, {
- // define in which phases this plugin should get applied.
- // you can also use multiple phases or negate them.
- // however, users can still overwrite them in their configuration if they really want to.
- phases: [PHASE_DEVELOPMENT_SERVER],
- webpack(config, options) {
- // https://gist.github.com/dutchenkoOleg/c561d59c1ec9dbcc9414f6e4274c706d
- if (!options.isServer) {
- const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
- config.plugins.push(new ForkTsCheckerWebpackPlugin());
- }
- if (typeof nextConfig.webpack === 'function') {
- return nextConfig.webpack(config, options);
- }
- return config;
- },
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement