question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

co-located test types included in dist (`tsconfig` `exclude` vs plugin `exclude`)

See original GitHub issue

What happens and why it is wrong

I’m building a Vue component library with vue-sfc-rollup. I’ve put each component in its own sub-directory to make it easy to group Jest tests, Storybook stories, etc. The tests are written in typescript and follow a ComponentName.spec.ts naming convention.

Since the tests are not imported anywhere, I would expect them to not be included in the build. However, after running a build, the test setup in my /tests directory and the test files that sit next to each component are having their type definitions included in the /dist output directory.

I tried adding an exclude config to the typescript plugin based on this StackOverflow answer https://stackoverflow.com/a/68687006/46914

This didn’t seem to help; the excludes were not being respected. Finally, I wound up trying one of the other suggestion the same StackOverflow post and put the excludes in the tsconfig.json. This worked; the types the test setup and the test themselves were both excluded. However, this also removes proper type checking for these test files, something I want to keep.

Environment

Versions
    rollup: ^2.52.8 => 2.56.3 
    rollup-plugin-typescript2: ^0.30.0 => 0.30.0 
    typescript: ^4.3.5 => 4.3.5 

rollup.config.js

`rollup.config.js`:

// rollup.config.js import fs from ‘fs’; import path from ‘path’; import vue from ‘rollup-plugin-vue’; import alias from ‘@rollup/plugin-alias’; import commonjs from ‘@rollup/plugin-commonjs’; import resolve from ‘@rollup/plugin-node-resolve’; import replace from ‘@rollup/plugin-replace’; import babel from ‘@rollup/plugin-babel’; import { terser } from ‘rollup-plugin-terser’; import ttypescript from ‘ttypescript’; import typescript from ‘rollup-plugin-typescript2’; import minimist from ‘minimist’;

// Get browserslist config and remove ie from es build targets const esbrowserslist = fs.readFileSync(‘./.browserslistrc’) .toString() .split(‘\n’) .filter((entry) => entry && entry.substring(0, 2) !== ‘ie’);

// Extract babel preset-env config, to combine with esbrowserslist const babelPresetEnvConfig = require(‘…/babel.config’) .presets.filter((entry) => entry[0] === ‘@babel/preset-env’)[0][1];

const argv = minimist(process.argv.slice(2));

const projectRoot = path.resolve(__dirname, ‘…’);

const baseConfig = { input: ‘src/entry.ts’, plugins: { preVue: [ alias({ entries: [ { find: ‘@’, replacement: ${path.resolve(projectRoot, 'src')}, }, ], }), ], replace: { ‘process.env.NODE_ENV’: JSON.stringify(‘production’), }, vue: { css: true, template: { isProduction: true, }, }, postVue: [ resolve({ extensions: [‘.js’, ‘.jsx’, ‘.ts’, ‘.tsx’, ‘.vue’], }), commonjs(), ], babel: { exclude: ‘node_modules/**’, extensions: [‘.js’, ‘.jsx’, ‘.ts’, ‘.tsx’, ‘.vue’], babelHelpers: ‘bundled’, }, }, };

// ESM/UMD/IIFE shared settings: externals // Refer to https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency const external = [ // list external dependencies, exactly the way it is written in the import statement. // eg. ‘jquery’ ‘vue’, ‘@vue/composition-api’, ];

// UMD/IIFE shared settings: output.globals // Refer to https://rollupjs.org/guide/en#output-globals for details const globals = { // Provide global variable names to replace your external imports // eg. jquery: ‘$’ vue: ‘Vue’, };

// Customize configs for individual targets const buildFormats = []; if (!argv.format || argv.format === ‘es’) { const esConfig = { …baseConfig, input: ‘src/entry.esm.ts’, external, output: { file: ‘dist/arternal-components.esm.js’, format: ‘esm’, exports: ‘named’, }, plugins: [ replace(baseConfig.plugins.replace), …baseConfig.plugins.preVue, vue(baseConfig.plugins.vue), …baseConfig.plugins.postVue, // Only use typescript for declarations - babel will // do actual js transformations typescript({ typescript: ttypescript, useTsconfigDeclarationDir: true, emitDeclarationOnly: true, // TODO: for some reason these do not exclude unless set in tsconfig.json exclude: [ “/tests", "/tests”, “**/*.spec.ts”, ], }), babel({ …baseConfig.plugins.babel, presets: [ [ ‘@babel/preset-env’, { …babelPresetEnvConfig, targets: esbrowserslist, }, ], ], }), ], }; buildFormats.push(esConfig); }

if (!argv.format || argv.format === ‘cjs’) { const umdConfig = { …baseConfig, external, output: { compact: true, file: ‘dist/arternal-components.ssr.js’, format: ‘cjs’, name: ‘ArternalComponents’, exports: ‘auto’, globals, }, plugins: [ replace(baseConfig.plugins.replace), …baseConfig.plugins.preVue, vue({ …baseConfig.plugins.vue, template: { …baseConfig.plugins.vue.template, optimizeSSR: true, }, }), …baseConfig.plugins.postVue, babel(baseConfig.plugins.babel), ], }; buildFormats.push(umdConfig); }

if (!argv.format || argv.format === ‘iife’) { const unpkgConfig = { …baseConfig, external, output: { compact: true, file: ‘dist/arternal-components.min.js’, format: ‘iife’, name: ‘ArternalComponents’, exports: ‘auto’, globals, }, plugins: [ replace(baseConfig.plugins.replace), …baseConfig.plugins.preVue, vue(baseConfig.plugins.vue), …baseConfig.plugins.postVue, babel(baseConfig.plugins.babel), terser({ output: { ecma: 5, }, }), ], }; buildFormats.push(unpkgConfig); }

// Export config export default buildFormats;

tsconfig.json

`tsconfig.json`:

{ “compilerOptions”: { “target”: “esnext”, “module”: “esnext”, “strict”: true, “declaration”: true, “declarationDir”: “dist/types”, “noUnusedLocals”: true, “noUnusedParameters”: true, “importHelpers”: true, “moduleResolution”: “node”, “experimentalDecorators”: true, “esModuleInterop”: true, “allowSyntheticDefaultImports”: true, “sourceMap”: true, “baseUrl”: “.”, “newLine”: “lf”, “types”: [ “node”, “vue”, “jest” ], “paths”: { “@/": [ "src/” ] }, “plugins”: [ { “transform”: “@zerollup/ts-transform-paths”, “exclude”: [ “*” ] } ], “lib”: [ “esnext”, “dom”, “dom.iterable”, “scripthost” ] }, “exclude”: [ “node_modules”, “dist” ] }

package.json

`package.json`:

{ “name”: “@arternal/components”, “version”: “0.1.1”, “description”: “”, “scripts”: { “serve”: “vue-cli-service serve dev/serve.ts”, “build”: “cross-env NODE_ENV=production rollup --config build/rollup.config.js”, “test:unit”: “vue-cli-service test:unit”, “build:es”: “cross-env NODE_ENV=production rollup --config build/rollup.config.js --format es”, “build:ssr”: “cross-env NODE_ENV=production rollup --config build/rollup.config.js --format cjs”, “build:unpkg”: “cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife”, “postbuild”: “rimraf ./dist/types/dev ./dist/types/src/entry.d.ts”, “prebuild”: “rimraf ./dist”, “storybook”: “start-storybook -p 6006”, “build-storybook”: “build-storybook” }, “main”: “dist/arternal-components.ssr.js”, “module”: “dist/arternal-components.esm.js”, “browser”: “dist/arternal-components.esm.js”, “unpkg”: “dist/arternal-components.min.js”, “files”: [ “dist/", "src/**/.vue” ], “dependencies”: { “@vue/composition-api”: “^1.1.3” }, “devDependencies”: { “@babel/core”: “^7.14.6”, “@babel/preset-env”: “^7.14.7”, “@babel/preset-typescript”: “^7.14.5”, “@rollup/plugin-alias”: “^3.1.2”, “@rollup/plugin-babel”: “^5.3.0”, “@rollup/plugin-commonjs”: “^14.0.0”, “@rollup/plugin-node-resolve”: “^9.0.0”, “@rollup/plugin-replace”: “^2.4.2”, “@storybook/addon-actions”: “^6.3.7”, “@storybook/addon-essentials”: “^6.3.7”, “@storybook/addon-links”: “^6.3.7”, “@storybook/vue”: “^6.3.7”, “@types/jest”: “^24.0.19”, “@vue/cli-plugin-babel”: “^4.5.13”, “@vue/cli-plugin-typescript”: “^4.5.13”, “@vue/cli-plugin-unit-jest”: “~4.5.0”, “@vue/cli-service”: “^4.5.13”, “@vue/test-utils”: “^1.0.3”, “@zerollup/ts-transform-paths”: “^1.7.18”, “autoprefixer”: “^9.8.6”, “babel-loader”: “^8.2.2”, “cross-env”: “^7.0.3”, “minimist”: “^1.2.5”, “postcss”: “^7.0.36”, “regenerator-runtime”: “^0.13.9”, “rimraf”: “^3.0.2”, “rollup”: “^2.52.8”, “rollup-plugin-terser”: “^7.0.2”, “rollup-plugin-typescript2”: “^0.30.0”, “rollup-plugin-vue”: “^5.1.9”, “tailwindcss”: “npm:@tailwindcss/postcss7-compat@^2.2.9”, “ttypescript”: “^1.5.12”, “typescript”: “^4.3.5”, “vue”: “^2.6.14”, “vue-loader”: “^15.9.8”, “vue-template-compiler”: “^2.6.14” }, “peerDependencies”: { “vue”: “^2.6.14” }, “engines”: { “node”: “>=12” }, “sideEffects”: false, “types”: “dist/types/src/entry.esm.d.ts” }

plugin output with verbosity 3

plugin output with verbosity 3:

src/entry.esm.ts → dist/arternal-components.esm.js… rpt2: built-in options overrides: { “noEmitHelpers”: false, “importHelpers”: true, “noResolve”: false, “noEmit”: false, “inlineSourceMap”: false, “outDir”: “/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/placeholder”, “moduleResolution”: 2, “allowNonTsExtensions”: true } rpt2: parsed tsconfig: { “options”: { “target”: 99, “module”: 99, “strict”: true, “declaration”: true, “declarationDir”: “/home/soviut/projects/arternal/shared-components/dist/types”, “noUnusedLocals”: true, “noUnusedParameters”: true, “importHelpers”: true, “moduleResolution”: 2, “experimentalDecorators”: true, “esModuleInterop”: true, “allowSyntheticDefaultImports”: true, “sourceMap”: true, “baseUrl”: “/home/soviut/projects/arternal/shared-components”, “newLine”: 1, “types”: [ “node”, “vue”, “jest” ], “paths”: { “@/": [ "src/” ] }, “plugins”: [ { “transform”: “@zerollup/ts-transform-paths”, “exclude”: [ “" ] } ], “lib”: [ “lib.esnext.d.ts”, “lib.dom.d.ts”, “lib.dom.iterable.d.ts”, “lib.scripthost.d.ts” ], “configFilePath”: “/home/soviut/projects/arternal/shared-components/tsconfig.json”, “pathsBasePath”: “/home/soviut/projects/arternal/shared-components”, “noEmitHelpers”: false, “noResolve”: false, “noEmit”: false, “inlineSourceMap”: false, “outDir”: “/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/placeholder”, “allowNonTsExtensions”: true }, “fileNames”: [ “/home/soviut/projects/arternal/shared-components/shims-tsx.d.ts”, “/home/soviut/projects/arternal/shared-components/shims-vue.d.ts”, “/home/soviut/projects/arternal/shared-components/dev/serve.ts”, “/home/soviut/projects/arternal/shared-components/src/entry.esm.ts”, “/home/soviut/projects/arternal/shared-components/src/entry.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/index.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/AvatarPill.spec.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/index.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/LinearChart.spec.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/index.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/RingChart.spec.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/index.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/Toggle.spec.ts”, “/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/index.ts”, “/home/soviut/projects/arternal/shared-components/tests/unit/setup.ts” ], “typeAcquisition”: { “enable”: false, “include”: [], “exclude”: [] }, “raw”: { “compilerOptions”: { “target”: “esnext”, “module”: “esnext”, “strict”: true, “declaration”: true, “declarationDir”: “dist/types”, “noUnusedLocals”: true, “noUnusedParameters”: true, “importHelpers”: true, “moduleResolution”: “node”, “experimentalDecorators”: true, “esModuleInterop”: true, “allowSyntheticDefaultImports”: true, “sourceMap”: true, “baseUrl”: “.”, “newLine”: “lf”, “types”: [ “node”, “vue”, “jest” ], “paths”: { "@/”: [ “src/" ] }, “plugins”: [ { “transform”: “@zerollup/ts-transform-paths”, “exclude”: [ "” ] } ], “lib”: [ “esnext”, “dom”, “dom.iterable”, “scripthost” ] }, “exclude”: [ “node_modules”, “dist” ], “compileOnSave”: false }, “errors”: [], “wildcardDirectories”: { “/home/soviut/projects/arternal/shared-components”: 1 }, “compileOnSave”: false } rpt2: typescript version: 4.3.5 rpt2: tslib version: 2.1.0 rpt2: rollup version: 2.56.3 rpt2: rollup-plugin-typescript2 version: 0.30.0 rpt2: plugin options: { “typescript”: “version 4.3.5”, “useTsconfigDeclarationDir”: true, “emitDeclarationOnly”: true, “verbosity”: 3, “check”: true, “clean”: false, “cacheRoot”: “/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2”, “include”: [ “.ts+(|x)", "**/.ts+(|x)” ], “exclude”: [ “.d.ts", "**/.d.ts” ], “abortOnError”: true, “rollupCommonJSResolveHack”: false, “tsconfigOverride”: {}, “transformers”: [], “tsconfigDefaults”: {}, “objectHashIgnoreUnknownHack”: false, “cwd”: “/home/soviut/projects/arternal/shared-components” } rpt2: rollup config: { “external”: [ “vue”, “@vue/composition-api” ], “input”: “src/entry.esm.ts”, “plugins”: [ { “name”: “replace” }, { “name”: “alias” }, { “name”: “VuePlugin” }, { “name”: “node-resolve” }, { “name”: “commonjs” }, { “name”: “rpt2” }, { “name”: “babel” }, { “name”: “stdin” } ], “output”: [ { “exports”: “named”, “file”: “dist/arternal-components.esm.js”, “format”: “esm”, “plugins”: [] } ] } rpt2: tsconfig path: /home/soviut/projects/arternal/shared-components/tsconfig.json rpt2: included: [ “.ts+(|x)", "**/.ts+(|x)” ] rpt2: excluded: [ “.d.ts", "**/.d.ts” ] (node:1418) [DEP0148] DeprecationWarning: Use of deprecated folder mapping “./” in the “exports” field module resolution of the package at /home/soviut/projects/arternal/shared-components/node_modules/tslib/package.json. Update this package.json to use a subpath pattern like “./*”. (Use node --trace-deprecation ... to show where the warning was created) rpt2: Ambient types: rpt2: /home/soviut/projects/arternal/shared-components/shims-tsx.d.ts rpt2: /home/soviut/projects/arternal/shared-components/shims-vue.d.ts rpt2: /home/soviut/projects/arternal/shared-components/node_modules/@types/node/index.d.ts rpt2: /home/soviut/projects/arternal/shared-components/node_modules/@types/jest/index.d.ts rpt2: ambient types changed, redoing all semantic diagnostics rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/entry.esm.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/d23588596eb6d0649c602de7386d61877186ccff’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/d23588596eb6d0649c602de7386d61877186ccff’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/d23588596eb6d0649c602de7386d61877186ccff’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/entry.esm.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/index.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/48e0bbe76d94190d44edcc4fe102bd89b59d8de0’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/48e0bbe76d94190d44edcc4fe102bd89b59d8de0’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/48e0bbe76d94190d44edcc4fe102bd89b59d8de0’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/index.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/index.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/e17ad1cb70b06bb62a0aec98d95e0449fc5ef7ec’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/e17ad1cb70b06bb62a0aec98d95e0449fc5ef7ec’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/e17ad1cb70b06bb62a0aec98d95e0449fc5ef7ec’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/index.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/index.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/ec83024138360c1637ba5d324a15a3395559254e’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/ec83024138360c1637ba5d324a15a3395559254e’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/ec83024138360c1637ba5d324a15a3395559254e’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/index.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/index.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/0b1f3b293dfdc58aa6ee7dcf49e802ee4a77d810’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/0b1f3b293dfdc58aa6ee7dcf49e802ee4a77d810’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/0b1f3b293dfdc58aa6ee7dcf49e802ee4a77d810’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/index.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/index.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/6ba43b99645dcf89d1636a3049140db96bcce432’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/6ba43b99645dcf89d1636a3049140db96bcce432’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/6ba43b99645dcf89d1636a3049140db96bcce432’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/index.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/AvatarPill.vue?rollup-plugin-vue=script.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/5385fedc1bcf7f2133755af70fb708fccf2554f4’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/5385fedc1bcf7f2133755af70fb708fccf2554f4’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/5385fedc1bcf7f2133755af70fb708fccf2554f4’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/AvatarPill.vue?rollup-plugin-vue=script.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/LinearChart.vue?rollup-plugin-vue=script.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/2eda56c72ff92e8ab8166f6e26252bcdb248557b’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/2eda56c72ff92e8ab8166f6e26252bcdb248557b’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/2eda56c72ff92e8ab8166f6e26252bcdb248557b’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/LinearChart.vue?rollup-plugin-vue=script.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/RingChart.vue?rollup-plugin-vue=script.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/b8bb598e1797b13f1406777c08107cddab8af7d0’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/b8bb598e1797b13f1406777c08107cddab8af7d0’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/b8bb598e1797b13f1406777c08107cddab8af7d0’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/RingChart.vue?rollup-plugin-vue=script.ts’ rpt2: transpiling ‘/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/Toggle.vue?rollup-plugin-vue=script.ts’ rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/code/cache/6fd65492c1e2d90e63bb6e0ab580e481f216c1f5’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/syntacticDiagnostics/cache/6fd65492c1e2d90e63bb6e0ab580e481f216c1f5’ rpt2: cache miss rpt2: cache: ‘/home/soviut/projects/arternal/shared-components/node_modules/.cache/rollup-plugin-typescript2/rpt2_df69ec664174241979228bef6d9df36f2966eacb/semanticDiagnostics/cache/6fd65492c1e2d90e63bb6e0ab580e481f216c1f5’ rpt2: cache miss rpt2: generated declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/Toggle.vue?rollup-plugin-vue=script.ts’ rpt2: generating target 1 rpt2: rolling caches rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/shims-tsx.d.ts’ rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/shims-vue.d.ts’ rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/dev/serve.ts’ rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/src/entry.ts’ rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/AvatarPill.spec.ts’ rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/LinearChart.spec.ts’ rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/RingChart.spec.ts’ rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/Toggle.spec.ts’ rpt2: generating missed declarations for ‘/home/soviut/projects/arternal/shared-components/tests/unit/setup.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/entry.esm.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/entry.esm.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/index.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/index.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/index.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/AvatarPill/index.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/index.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/LinearChart/index.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/index.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/RingChart/index.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/index.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/Toggle/index.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/AvatarPill.vue?rollup-plugin-vue=script.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/AvatarPill/AvatarPill.vue.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/LinearChart.vue?rollup-plugin-vue=script.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/LinearChart/LinearChart.vue.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/RingChart.vue?rollup-plugin-vue=script.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/RingChart/RingChart.vue.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/Toggle.vue?rollup-plugin-vue=script.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/Toggle/Toggle.vue.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/dev/serve.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/dev/serve.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/entry.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/entry.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/AvatarPill/AvatarPill.spec.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/AvatarPill/AvatarPill.spec.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/LinearChart/LinearChart.spec.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/LinearChart/LinearChart.spec.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/RingChart/RingChart.spec.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/RingChart/RingChart.spec.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/src/lib-components/Toggle/Toggle.spec.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/src/lib-components/Toggle/Toggle.spec.d.ts’ rpt2: emitting declarations for ‘/home/soviut/projects/arternal/shared-components/tests/unit/setup.ts’ to ‘/home/soviut/projects/arternal/shared-components/dist/types/tests/unit/setup.d.ts’ (!) Plugin replace: @rollup/plugin-replace: ‘preventAssignment’ currently defaults to false. It is recommended to set this option to true, as the next major version will default this option to true. created dist/arternal-components.esm.js in 3.5s

src/entry.ts → dist/arternal-components.ssr.js… (!) Plugin replace: @rollup/plugin-replace: ‘preventAssignment’ currently defaults to false. It is recommended to set this option to true, as the next major version will default this option to true. created dist/arternal-components.ssr.js in 766ms

src/entry.ts → dist/arternal-components.min.js… (!) Plugin replace: @rollup/plugin-replace: ‘preventAssignment’ currently defaults to false. It is recommended to set this option to true, as the next major version will default this option to true. (!) Missing global variable name Use output.globals to specify browser global variable names corresponding to external modules @vue/composition-api (guessing ‘compositionApi’) created dist/arternal-components.min.js in 990ms

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ezolenkocommented, Sep 9, 2021

rollup (and its plugins) generates a stream of files and each plugin decides to process them or not based on plugin-level include/exclude options. If you exclude something on plugin level, it will not be transpiled into js. If you exclude something on tsconfig level, but rollup finds it in other ways (from input in rollup config for example), then it will be transpiled.

The problem with types and some ts files is that rollup doesn’t see them if typescript doesn’t generate import statement in generated js (if you import a ts file, but only use type only information which gets stripped from js for example). This will normally result in missing types (ts file not showing up in rollup stream, no d.ts file made for it). That’s why the plugin takes all files found by typescript through tsconfig and just makes types for them, since it is better to make more than to miss something.

If you want to make a PR that would go through import chain for each transpiled file and flag them for type generation, I wouldn’t complain (look for allImportedFiles in index.ts, right now it gets filled with tsconfig files and everything rollup serves up).

1reaction
ezolenkocommented, Sep 9, 2021

Yep. like I said, types are different due to that workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

exclude - TSConfig Option - TypeScript
All of the common types in TypeScript ... How to provide a type shape to JavaScript objects ... How TypeScript infers types based...
Read more >
Setting up tsconfig with spec/test folder - Stack Overflow
I ended up defining multiple config files and use extends to simplify them. Say I have two files: tsconfig.json and tsconfig.build.json // tsconfig.json...
Read more >
Serverless Webpack - Serverless Framework: Plugins
A Serverless Framework plugin to build your lambda functions with Webpack. ... excludeFiles: src/**/*.test.js # Provide a glob for files to ignore ......
Read more >
Configure Storybook
storybook/main.js that matches all files in your project with extension .stories.* . The intention is you colocate a story file with the component...
Read more >
Exclude test files from Compilation in TypeScript | bobbyhadz
To exclude test files from compilation, but still have them type checked, create a second configuration file, e.g. `tsconfig.build.json`, which uses the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found