最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

npm - Removing SCSS included file warnings - Stack Overflow

programmeradmin0浏览0评论

I am building a Svelte project which relies on GDS components and styling from GOV UK frontend, and I get a lot of error messages similar to the one in the Warning message section below.

Is there a way I can build my application without getting these messages on startup, especially if this is having any effect on application start? I presume it's related to the use of <style lang="scss"> sections.

Vite config

I have the following in the project vite.config.ts file which is apparently meant to kill these warning but doesn't

    build: {
        sourcemap: true,
        rollupOptions: {
            onwarn: (warning, handler) => {
                //TODO: this is meant to suppress warnings from svelte compiler
                // specifically put this in for '10 external dependencies' warning but doesn't seem to work
                // Need to investigate further
                // e.g. don't warn on a11y-autofocus
                if (warning.code === 'a11y-click-events-have-key-events') return;
                if (warning.code === 'vite-plugin-svelte-preprocess-many-dependencies') return;

                // let vite handle all other warnings normally
                handler(warning);
            }
        }
    }
});

Warning message

10:30:32 AM [vite-plugin-svelte] /project/src/lib/components/Header.svelte svelte.preprocess depends on more than 10 external files which can cause slow builds and poor DX,
 try to reduce them. Found: /project/src/routes/_gov-base-custom.scss,
 /project/node_modules/govuk-frontend/dist/govuk/_base.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_index.scss,
 /project/node_modules/govuk-frontend/dist/agovuk/settings/_assets.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_warnings.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_global-styles.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_colours-palette.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_colours-anisations.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_spacing.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_measurements.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_typography-font.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss,
 /project/node_modules/govuk-frontend/dist/govuk/settings/_links.scss,
 /project/node_modules/govuk-frontend/dist/govuk/tools/_index.scss,
 /project/node_modules/govuk-frontend/dist/govuk/tools/_exports.scss,
 /project/node_modules/govuk-frontend/dist/govuk/tools/_font-url.scss,
 /project/node_modules/govuk-frontend/dist/govuk/tools/_image-url.scss,
 /project/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss,
 /project/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_index.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_clearfix.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_device-pixels.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_font-faces.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss,
 /project/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss,
 /project/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss

发布评论

评论列表(0)

  1. 暂无评论