ezolenko / rollup-plugin-typescript2

Rollup plugin for typescript with compiler errors.
MIT License
822 stars 71 forks source link

`semantic error TS2339: Property 'X' doesn't exist on type 'Y'` with Vite and Vue2 SFC #352

Closed Rusinas closed 2 years ago

Rusinas commented 2 years ago

Troubleshooting

I am trying to build Vue 2 library using Vite. There is a lot of typescript, so I need rollup-plugin-typescript, but there are some weird issues. When I run build, it fails and point to the random .ts file telling me that there is a unexisting property, for example:

vite v2.9.10 building for production...
✓ 154 modules transformed.
[rpt2] C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/AssetList.vue?vue&type=script&lang.ts(22,24): semantic error TS2339: Property 'items' does not exist on type 'AssetList'.
file: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/AssetList.vue?vue&type=script&lang.ts
error during build:
Error: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/AssetList.vue?vue&type=script&lang.ts(22,24): semantic error TS2339: Property 'items' does not exist on type 'AssetList'.
    at error (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:198:30)
    at throwPluginError (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:21936:12)
    at Object.error (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:22659:20)
    at Object.error (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:22113:42)
    at RollupContext.error (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:17311:30)
    at C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:25141:23
    at arrayEach (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:585:11)
    at Function.forEach (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:9465:14)
    at printDiagnostics (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:25114:14)
    at Object.transform (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:30268:17)
    at C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:22868:37
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

In this particular case we're using Vue 2 with Class API in order to work with TS and the script looks like this:

<script lang="ts">
import Vue from 'vue';
import { Prop, Component } from 'vue-property-decorator';

import Sizes, { SizesArray } from '@/constants/Sizes';

import AssetListItem from '@/components/common/asset-list/AssetListItem.vue';
import Loader from '@/components/common/Loader.vue';

import { IDocumentItem } from '@/model';

const Events = {
  DELETE: 'delete',
};

@Component({
  name: 'AssetList',
  components: {
    AssetListItem,
    Loader,
  },
})
export default class AssetList extends Vue {
  @Prop({ required: true, type: Array })
  readonly items!: IDocumentItem[]; // <------ this is it!

  @Prop({ required: false, type: Boolean, default: false })
  readonly deletable!: boolean;

  @Prop({
    required: false,
    type: String,
    default: Sizes.MEDIUM,
    validator: (value:string) => SizesArray.includes(value),
  })
  readonly size!: string;

  @Prop({ required: false, type: Boolean, default: false })
  readonly download!: boolean;

  @Prop({ required: false, type: Boolean, default: false })
  readonly loading!: boolean;

  @Prop({ required: false, type: String, default: 'asset-list' })
  readonly dataTest!: string;

  onDeleteClick(item: IDocumentItem): void {
    const index = this.items.indexOf(item);
    console.log('> AssetList -> onDelete', { index });
    this.$emit(Events.DELETE, index);
  }
}
</script>

And it points to the different files every time. tsc compiles all the files correctly.

Environment

Versions

npmPackages:
    rollup: ^2.38.5 => 2.75.6
    rollup-plugin-typescript2: ^0.31.1 => 0.31.1
    typescript: ^4.7.3 => 4.7.3

rollup.config.js

:
vite.config.js ```js const { defineConfig } = require('vite'); const { createVuePlugin } = require('vite-plugin-vue2'); const path = require('path'); const typescript = require('rollup-plugin-typescript2'); const { terser } = require('rollup-plugin-terser'); const commonjs = require('@rollup/plugin-commonjs'); import strip from '@rollup/plugin-strip'; module.exports = defineConfig({ resolve: { alias: { '@': path.resolve(__dirname, './src'), }, }, plugins: [ createVuePlugin(), ], css: { preprocessorOptions: { scss: { additionalData: '@import "@/assets/global.scss";', }, }, sass: { additionalData: '@import "@/assets/vuetify.scss"', }, }, build: { lib: { entry: path.resolve(__dirname, 'src/entry.ts'), name: 'OncoshotDesignSystem', fileName: (format) => `oncoshot-design-system.${format}.js`, }, rollupOptions: { input: 'src/entry.ts', external: [ 'vue', 'vuetify/lib', 'vuetify/lib/directives', 'date-fns', 'date-fns/locale', ], output: { name: 'OncoshotDesignSystem', exports: 'named', globals: { vue: 'Vue', }, }, plugins: [ typescript({ tsconfig: path.resolve(__dirname, 'tsconfig.json'), exclude: ['node_modules/**'], transpiler: 'babel', }), terser({ output: { ecma: 5, }, }), commonjs(), strip(['**/*.js', '**/*.ts', '**/*.vue']), ], }, }, }); ```

tsconfig.json

:
```json5 { "compilerOptions": { "target": "es6", "module": "es6", "strict": true, "declaration": true, "declarationDir": "dist", "noUnusedLocals": false, "noUnusedParameters": true, "jsx": "preserve", "importHelpers": true, "moduleResolution": "node", "experimentalDecorators": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "noImplicitAny": false, "sourceMap": true, "baseUrl": ".", "types": [ "@testing-library/jest-dom", "jest", "lodash", "node", "vue" ], "paths": { "@/*": [ "src/*" ] }, "lib": [ "esnext", "dom", "dom.iterable", "scripthost" ] }, "include": [ "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue" ], "exclude": [ "node_modules", "dist" ] } ```

package.json

:
```json { "name": "design-system", "version": "8.1.0", "private": false, "scripts": { "build:vite": "vite build", }, "main": "dist/design-system.ssr.js", "module": "dist/design-system.esm.js", "browser": "dist/design-system.esm.js", "unpkg": "dist/design-system.min.js", "exports": { ".": { "import": "./dist/design-system.es.js", "require": "./dust/design-system.umd.js" } }, "files": [ "dist", "src/assets/**", "src/components/**", "src/directives/**", "src/model/**", "src/utils/**", "src/vendor/**" ], "dependencies": { "caniuse-lite": "^1.0.30001257" }, "devDependencies": { "@babel/core": "^7.13.8", "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-decorators": "^7.12.13", "@babel/preset-env": "^7.16.8", "@babel/preset-typescript": "^7.12.16", "@dtsgenerator/replace-namespace": "^1.5.1", "@faker-js/faker": "^5.5.3", "@mdi/js": "^6.5.95", "@rollup/plugin-alias": "^3.1.2", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-image": "^2.0.6", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^11.2.0", "@rollup/plugin-replace": "^2.3.2", "@rollup/plugin-strip": "^2.0.0", "@storybook/addon-actions": "^6.5.7", "@storybook/addon-essentials": "^6.5.7", "@storybook/addon-interactions": "^6.5.7", "@storybook/addon-links": "^6.5.7", "@storybook/builder-vite": "^0.1.36", "@storybook/preset-scss": "^1.0.3", "@storybook/preset-typescript": "^3.0.0", "@storybook/testing-library": "^0.0.11", "@storybook/vue": "^6.5.7", "@testing-library/jest-dom": "^5.16.1", "@testing-library/vue": "^5.8.2", "@types/jest": "^27.4.0", "@types/lodash": "^4.14.178", "@types/mime-db": "^1.43.1", "@typescript-eslint/eslint-plugin": "^4.16.1", "@typescript-eslint/parser": "^4.16.1", "@vue/cli-plugin-babel": "^4.5.16", "@vue/cli-plugin-eslint": "^4.5.16", "@vue/cli-plugin-typescript": "^4.5.16", "@vue/cli-plugin-unit-jest": "^4.5.16", "@vue/cli-service": "^4.5.16", "@vue/eslint-config-standard": "^6.0.0", "@vue/eslint-config-typescript": "^7.0.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "chromatic": "^5.8.2", "core-js": "^3.8.3", "cross-env": "^7.0.2", "css-loader": "^5.1.1", "date-fns": "^2.17.0", "dtsgenerator": "^3.15.0", "eslint": "^7.19.0", "eslint-config-airbnb-base": "^14.2.1", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.20.2", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^4.3.1", "eslint-plugin-standard": "^4.1.0", "eslint-plugin-storybook": "^0.5.5", "eslint-plugin-vue": "^7.7.0", "eslint-plugin-vuetify": "^1.0.0-beta.7", "file-loader": "^6.2.0", "husky": "^5.1.3", "intermock": "^0.2.5", "jest": "^27.5.1", "json-loader": "^0.5.7", "lint-staged": "^10.5.4", "lodash": "^4.17.21", "mime-db": "^1.52.0", "minimist": "^1.2.6", "path": "^0.12.7", "rollup": "^2.38.5", "rollup-plugin-delete": "^2.0.0", "rollup-plugin-scss": "^2.6.1", "rollup-plugin-styles": "^3.14.1", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.31.1", "rollup-plugin-vue": "^5.1.9", "rollup-plugin-vuetify": "^0.2.4", "sass": "~1.32.13", "sass-loader": "^8.0.2", "storybook-addon-designs": "^6.2.1", "storybook-builder-vite-vue2": "^0.1.32", "style-loader": "^2.0.0", "tiptap": "1.30.0", "tiptap-commands": "1.15.0", "tiptap-extensions": "1.33.0", "typescript": "^4.7.3", "vite": "^2.9.10", "vite-plugin-vue2": "^2.0.1", "vue": "^2.6.11", "vue-class-component": "^7.2.3", "vue-client-only": "^2.1.0", "vue-docgen-web-types": "^0.1.7", "vue-property-decorator": "^8.4.2", "vue-router": "^3.5.1", "vue-template-compiler": "^2.6.11", "vuelidate": "^0.7.6", "vuetify": "^2.4.4", "vuetify-loader": "^1.7.2", "vuex": "^3.6.2" }, "peerDependencies": { "vue": "^2.6.11", "vue-class-component": "^7.2.3", "vue-property-decorator": "^8.4.2" }, "engines": { "node": ">=12" }, "husky": { "hooks": { "pre-commit": "eslint --ext .ts,.js,.vue --ignore-path .gitignore . " } }, "lint-staged": { "*.{js,jsx,vue,ts,tsx}": [ "vue-cli-service lint", "git add" ] }, "types": "dist/entry.d.ts", "web-types": "web-types.json" } ```

plugin output with verbosity 3

:
```text vite v2.9.10 building for production... rpt2: built-in options overrides: { "noEmitHelpers": false, "importHelpers": true, "noResolve": false, "noEmit": false, "inlineSourceMap": false, "outDir": "C:\\Users\\Work\\Desktop\\Code\\Oncoshot-Design-System\\node_modules\\.cache\\rollup-plugin-typescript2/placeholder", "moduleResolution": 2, "allowNonTsExtensions": true } rpt2: parsed tsconfig: { "options": { "target": 2, "module": 5, "strict": true, "declaration": true, "noUnusedLocals": false, "noUnusedParameters": true, "jsx": 1, "importHelpers": true, "moduleResolution": 2, "experimentalDecorators": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "noImplicitAny": false, "sourceMap": true, "baseUrl": "C:/Users/Work/Desktop/Code/Oncoshot-Design-System", "types": [ "@testing-library/jest-dom", "jest", "lodash", "node", "vue" ], "paths": { "@/*": [ "src/*" ] }, "lib": [ "lib.esnext.d.ts", "lib.dom.d.ts", "lib.dom.iterable.d.ts", "lib.scripthost.d.ts" ], "configFilePath": "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/tsconfig.json", "pathsBasePath": "C:/Users/Work/Desktop/Code/Oncoshot-Design-System", "noEmitHelpers": false, "noResolve": false, "noEmit": false, "inlineSourceMap": false, "outDir": "C:\\Users\\Work\\Desktop\\Code\\Oncoshot-Design-System\\node_modules\\.cache\\rollup-plugin-typescript2/placeholder", "allowNonTsExtensions": true }, "fileNames": [ "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/entry.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/plugins.d.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/shims-vue.d.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/shims.d.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/index.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/DropdownMenu.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/SidePanel.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/asset-list/AssetListItem.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/common/AssigneeModal.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/common/ChatPanel.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/common/ModalActivator.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/common/header/HeaderMenuUser.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/feasibility/InsightsRequestTable.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/feasibility/insights-request-table/InsightsRequestTableParentRow.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/feasibility/insights-request-table/InsightsRequestTableRow.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/organization/OrganizationSettingsMembersTable.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/profiles/ProfileItem.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/trials/TrialAssignee.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/features/trials/TrialItem.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/form/DataMultipleSelect.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Breakpoints.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Colors.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Dialogs.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/FilterTypes.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Icons.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/LocalStorage.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/ProfileStatuses.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/SidePositions.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Sizes.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Tags.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Toasts.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Transitions.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/TrialTypes.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Typography.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/UserRoles.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Views.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/VitalStatuses.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/components/DateInput.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/directives/autofocus.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/directives/index.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/index.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interfaces.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/dto/AssigneeDTO.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/dto/FilterConditionsDTO.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/dto/ProfileEnrollmentDTO.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IBreadcrumb.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IChatFormMessage.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IDataMultipleSelectItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IDefinition.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IDropdownMenuItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IFacilityStatus.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IFilterListItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IInsightItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IInsightsRequestItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IMenuItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IOwner.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IPopup.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IProfileEnrollment.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IProfileEnrollmentHistoryItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IProfileEnrollmentStatusParams.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IProfileOncologistParams.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IScrollableList.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/ISearchCondition.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/ISocialItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/ISubscription.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/ITab.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IToken.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/ITreatmentCriteria.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/ITrialInsight.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IUniversalMultiselectListItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IUserAccount.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IUserOrganizationListItem.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/interface/IUserRole.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/options/DialogOptions.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/options/PopupOptions.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/options/ToastOptions.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/vo/InsightItemVO.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/vo/LinkVO.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/vo/ProfileShareVO.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/tests/utils/jest.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/arrayUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/barchartUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/colorUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/dataUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/filterUtils.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/filterUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/index.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/linkUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/matchingUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/objectUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/profileUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/sizeUtils.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/sizeUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/stringUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/timeUtils.test.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/timeUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/trialUtils.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/vendor/api-interfaces.dist.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/vendor/apisite-interfaces.dist.ts", "C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/vendor/interfaces.dist.ts" ], "typeAcquisition": { "enable": false, "include": [], "exclude": [] }, "raw": { "compilerOptions": { "target": "es6", "module": "es6", "strict": true, "declaration": true, "declarationDir": "dist", "noUnusedLocals": false, "noUnusedParameters": true, "jsx": "preserve", "importHelpers": true, "moduleResolution": "node", "experimentalDecorators": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "noImplicitAny": false, "sourceMap": true, "baseUrl": ".", "types": [ "@testing-library/jest-dom", "jest", "lodash", "node", "vue" ], "paths": { "@/*": [ "src/*" ] }, "lib": [ "esnext", "dom", "dom.iterable", "scripthost" ] }, "include": [ "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue" ], "exclude": [ "node_modules", "dist" ], "compileOnSave": false }, "errors": [], "wildcardDirectories": { "c:/users/work/desktop/code/oncoshot-design-system/src": 1 }, "compileOnSave": false } rpt2: typescript version: 4.7.3 rpt2: tslib version: 2.3.1 rpt2: rollup version: 2.75.6 rpt2: rollup-plugin-typescript2 version: 0.31.1 rpt2: plugin options: { "tsconfig": "C:\\Users\\Work\\Desktop\\Code\\Oncoshot-Design-System\\tsconfig.json", "exclude": [ "node_modules/**" ], "transpiler": "babel", "verbosity": 3, "check": true, "clean": false, "cacheRoot": "C:\\Users\\Work\\Desktop\\Code\\Oncoshot-Design-System\\node_modules\\.cache\\rollup-plugin-typescript2", "include": [ "*.ts+(|x)", "**/*.ts+(|x)" ], "abortOnError": true, "rollupCommonJSResolveHack": false, "useTsconfigDeclarationDir": false, "tsconfigOverride": {}, "transformers": [], "tsconfigDefaults": {}, "objectHashIgnoreUnknownHack": false, "cwd": "C:\\Users\\Work\\Desktop\\Code\\Oncoshot-Design-System", "typescript": "version 4.7.3" } rpt2: rollup config: { "input": "src/entry.ts", "context": "globalThis", "preserveEntrySignatures": "strict", "external": [ "vue", "vuetify/lib", "vuetify/lib/directives", "date-fns", "date-fns/locale" ], "output": { "name": "OncoshotDesignSystem", "exports": "named", "globals": { "vue": "Vue" } }, "plugins": [ { "name": "vite:build-metadata" }, { "name": "alias" }, { "name": "vite:modulepreload-polyfill" }, { "name": "vite:resolve" }, { "name": "vite:html-inline-proxy" }, { "name": "vite:css" }, { "name": "vite:esbuild" }, { "name": "vite:json" }, { "name": "vite:wasm" }, { "name": "vite:worker" }, { "name": "vite:asset" }, { "name": "vite-plugin-vue2" }, { "name": "vite:define" }, { "name": "vite:css-post" }, { "name": "vite:build-html" }, { "name": "vite:worker-import-meta-url" }, { "name": "vite:watch-package-data" }, { "name": "commonjs" }, { "name": "vite:data-uri" }, { "name": "rollup-plugin-dynamic-import-variables" }, { "name": "vite:asset-import-meta-url" }, { "name": "rpt2" }, { "name": "terser" }, { "name": "commonjs" }, { "name": "strip" }, { "name": "vite:build-import-analysis" }, { "name": "vite:esbuild-transpile" }, { "name": "vite:terser" }, { "name": "vite:reporter" }, { "name": "vite:load-fallback" } ] } rpt2: tsconfig path: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/tsconfig.json rpt2: included: [ "*.ts+(|x)", "**/*.ts+(|x)" ] rpt2: excluded: [ "node_modules/**" ] rpt2: Ambient types: rpt2: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/plugins.d.ts rpt2: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/shims-vue.d.ts rpt2: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/shims.d.ts rpt2: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/node_modules/@types/jest/index.d.ts rpt2: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/node_modules/@types/lodash/index.d.ts rpt2: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/node_modules/@types/node/index.d.ts rpt2: ambient types changed, redoing all semantic diagnostics rpt2: transpiling 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\src\entry.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/1e983dcf856448002117b4b0e8170b0b89364d5f' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/1e983dcf856448002117b4b0e8170b0b89364d5f' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/1e983dcf856448002117b4b0e8170b0b89364d5f' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/entry.ts' transforming (1) src\entry.tsrpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/index.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/450ab25bc6d8395c46b77530ab33c0d4d9b9b0a5' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/450ab25bc6d8395c46b77530ab33c0d4d9b9b0a5' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/450ab25bc6d8395c46b77530ab33c0d4d9b9b0a5' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/model/index.ts' rpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/index.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/962222233e8802397cc1cc989235aeb0f2ae619c' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/962222233e8802397cc1cc989235aeb0f2ae619c' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/962222233e8802397cc1cc989235aeb0f2ae619c' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/utils/index.ts' rpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/directives/index.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/0a23e81181a65207824f593b79128c0b46376329' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/0a23e81181a65207824f593b79128c0b46376329' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/0a23e81181a65207824f593b79128c0b46376329' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/directives/index.ts' rpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Sizes.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/ad470c21276b727820634c0a548a5de725efea9d' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/ad470c21276b727820634c0a548a5de725efea9d' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/ad470c21276b727820634c0a548a5de725efea9d' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Sizes.ts' rpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/SidePositions.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/c51fa9a254019bb076785bb36e9622671d9aebf6' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/c51fa9a254019bb076785bb36e9622671d9aebf6' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/c51fa9a254019bb076785bb36e9622671d9aebf6' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/SidePositions.ts' rpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Views.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/7079877134b86d8bf31fdad139a60c495c23db93' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/7079877134b86d8bf31fdad139a60c495c23db93' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/7079877134b86d8bf31fdad139a60c495c23db93' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Views.ts' rpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Colors.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/05f22035679ad30f3147023d31ccbc57b1de2ab4' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/05f22035679ad30f3147023d31ccbc57b1de2ab4' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/05f22035679ad30f3147023d31ccbc57b1de2ab4' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Colors.ts' rpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Icons.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/9f90398019161ec4bbf1d8e91853493b7197752b' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/9f90398019161ec4bbf1d8e91853493b7197752b' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/9f90398019161ec4bbf1d8e91853493b7197752b' rpt2: cache miss rpt2: generated declarations for 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/constants/Icons.ts' transforming (96) src\components\features\profiles\ProfileItem.vuerpt2: transpiling 'C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/BarChart.vue?vue&type=script&lang.ts' rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/code/cache/8ccdd09c4cd263df8a9d1d4a1153e758ad4d27ad' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/syntacticDiagnostics/cache/8ccdd09c4cd263df8a9d1d4a1153e758ad4d27ad' rpt2: cache miss rpt2: cache: 'C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\.cache\rollup-plugin-typescript2/rpt2_e8d990597a459f2799ed7a329fae543f7c5b90fd/semanticDiagnostics/cache/8ccdd09c4cd263df8a9d1d4a1153e758ad4d27ad' rpt2: cache miss ✓ 154 modules transformed. [rpt2] C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/BarChart.vue?vue&type=script&lang.ts(27,10): semantic error TS2339: Property 'instantTransitions' does not exist on type 'BarChart'. file: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/BarChart.vue?vue&type=script&lang.ts error during build: Error: C:/Users/Work/Desktop/Code/Oncoshot-Design-System/src/components/common/BarChart.vue?vue&type=script&lang.ts(27,10): semantic error TS2339: Property 'instantTransitions' does not exist on type 'BarChart'. at error (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:198:30) at throwPluginError (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:21936:12) at Object.error (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:22659:20) at Object.error (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:22113:42) at RollupContext.error (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:17311:30) at C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:25141:23 at arrayEach (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:585:11) at Function.forEach (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:9465:14) at printDiagnostics (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:25114:14) at Object.transform (C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:30268:17) at C:\Users\Work\Desktop\Code\Oncoshot-Design-System\node_modules\rollup\dist\shared\rollup.js:22868:37 at processTicksAndRejections (internal/process/task_queues.js:95:5) ```
agilgur5 commented 2 years ago

I'm afraid that there's too many problems with this issue for it to be investigated:

  1. Portions of the issue template were removed without cause. This is generally frowned upon by the entire OSS community. Issue templates are there for a reason.

  2. The issue template asks if you have the correct plugin order based on this plugin's compatibility docs. Per the Vite config, the commonjs plugin is incorrectly placed after this plugin instead of before.

  3. The issue template asks if you can provide a minimal reproduction. This looks to be a large repository with many dependencies, including multiple compilers, syntax transforms, and plugins such as Vite/esbuild, Vue, Decorators, Babel, TypeScript, and more. It is effectively impossible to investigate such a complex configuration without a minimal reproduction. Even if volunteer contributors spent many, many hours of free time, finding a root cause may still not be within grasp. That's without getting into that there are only two maintainers of this repo and I'm fairly sure neither of us have Vue experience. The onus of integrating with an existing plugin should probably be on the new plugin developer as well 🤷 Nonetheless, I can try pointing out the various problems I've spotted to try to help give you guidance in configuring your project properly, but please recognize that issues are not a support forum.

  4. You provided an invalid option to this plugin. transpiler is not an option that this plugin accepts and this plugin does not use Babel in any way. Transpilation is done entirely via the TS API.

  5. You're using tsconfig paths, but I don't see a transformer of aliases in place. You may run into #201 as a result, though that only affects declaration output. I see you have @rollup/plugin-alias in your dependencies, but it is not listed in your config. #237 describes usage of that plugin.

  6. I don't have much experience with Vue (I built one of the first ever production websites to use React and have used it since), but from my cursory understanding, it looks like the Vue SFC integration is where the root cause may be:

    1. Vue SFCs don't work well with other loaders due to a chicken-and-egg problem with resolutions. This is described in the Vue 3 docs (which mentions how errors might be off) as well as here in https://github.com/ezolenko/rollup-plugin-typescript2/issues/129#issuecomment-705914078 and other comments. Basically TS needs to be able to resolve the module graph but it doesn't understand Vue SFCs.
    2. I don't believe this plugin is necessary to use when using Vite, as it supports supports TS out-of-the-box with esbuild already. See also https://github.com/ezolenko/rollup-plugin-typescript2/issues/129#issuecomment-1047159929
      • If you wanted to use this plugin for type-checking, you'd have to disable esbuild's support for TS, e.g. add exclude: /\.tsx?$/ to the Vite esbuild config
      • Or you could run this plugin before esbuild by adding enforce: 'pre' within the Vite config
    3. vite-plugin-vue2 uses Babel to transform TypeScript within SFCs.
      • This is not configurable as far as I can tell
    4. So with Vite and vite-plugin-vue2 supporting TS in some way, I'm not sure why this plugin is being used as well. Adding it as extra could cause problems, especially as your TS may have already been transpiled to untyped JS once rpt2 sees it. Some other notes:
      1. This plugin has a small integration with the older rollup-plugin-vue to handle virtual modules, but that only affects declaration output, not resolution or type-checking.
      2. That being said, the error message you're receiving is equivalent to #235, which is due to a bug within rollup-plugin-vue https://github.com/vuejs/rollup-plugin-vue/issues/311, not this plugin. It's possible Vite or vite-plugin-vue2 have a similar bug.

Possible workarounds, though again, it seems like the issue is with trying to transpile TS multiple times on top of each other with different plugins (esbuild, Babel, then rpt2 on the resultant untyped JS):

  1. Can always set check: false in this plugin's options to turn off type-checking. Note that a type error can cause incorrect compilation though, as that is TS behavior (or most compilers for that matter), not specific to this plugin.
  2. You can exclude Vue SFCs from this plugin (or, rather, the virtual modules that derive from a Vue SFC in the Rollup module graph). I believe this glob should work, but not 100% sure on that: **/*&lang.ts