Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading from v2.3.0 to v3.4.0 causes 'Outside emitted #258

Closed
3 tasks done
ExistentialAlex opened this issue Aug 3, 2023 · 3 comments
Closed
3 tasks done

Upgrading from v2.3.0 to v3.4.0 causes 'Outside emitted #258

ExistentialAlex opened this issue Aug 3, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@ExistentialAlex
Copy link

Describe the bug

When using 2.3.0 on my vue component library, the declaration files were generated correctly and I never had any issues.

When I do an upgrade to v3.4.0 with no other config changes I get the following;
image

The .d.ts files are no longer being output into dist/**.

Was there a change in how these were generated or is there another config option that I need?

Project structure:
/root/packages/components/**

Expected Output:
root/packages/components/dist/**

Actual Output:
root/types/components/**

Reproduction

ffve

Steps to reproduce

No response

System Info

System:
    OS: Linux 5.10 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (12) x64 Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
    Memory: 21.21 GB / 24.88 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.1/bin/yarn
    npm: 9.6.6 - ~/.nvm/versions/node/v18.12.1/bin/npm

Validations

@qmhc
Copy link
Owner

qmhc commented Aug 3, 2023

You need to provide your tsconfig.json and vite.config.ts at least, and better to provide a reproduction. It's very helpful to slove the issue.

@ExistentialAlex
Copy link
Author

ExistentialAlex commented Aug 3, 2023

Apologies, I had meant to!

Vite.config.ts:

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import svgLoader from 'vite-svg-loader';
import dts from 'vite-plugin-dts';
import { resolve } from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    svgLoader(),
    dts({
      insertTypesEntry: true,
    }),
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
    },
  },
  build: {
    lib: {
      entry: resolve(__dirname, 'src/main.ts'),
      name: 'adtech_sky_analytics_vue_component_library',
    },
    rollupOptions: {
      input: {
        main: resolve(__dirname, 'src/main.ts'),
      },

      external: ['vue'],
      output: {
        // Provide global variables to use in the UMD build
        // Add external deps here
        globals: {
          vue: 'Vue',
        },
        exports: 'named',
        assetFileNames: (assetInfo): string => {
          if (assetInfo.name === 'style.css') {
            return 'adtech-sky-analytics-vue-component-library.css';
          }
          return assetInfo.name || '';
        },
      },
    },
  },
});

tsconfig.json:

{
  "extends": "../../tsconfig.json",
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
  "compilerOptions": {
    "baseUrl": ".",
    "types": ["vite/client"],
    "isolatedModules": true,
    "paths": {
      "@/*": ["./src/*"],
      "vite-svg-loader": ["node_modules/vite-svg-loader"]
    },
    "strictNullChecks": false
  },
  "exclude": ["**/*.stories.ts"]
}

Root tsconfig.json:

{
  "compilerOptions": {
    "target": "ESNext",
    "useDefineForClassFields": true,
    "module": "ESNext",
    "moduleResolution": "node",
    "strict": true,
    "jsx": "preserve",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "esModuleInterop": true,
    "lib": ["ESNext", "DOM"],
    "skipLibCheck": true,
    "noEmit": true,
    "declaration": true,
    "declarationDir": "./types",
    "types": ["vitest/globals"],
    "paths": {
      "*": [
        "./node_modules/*",
        "./test/*"
      ]
    }
  },
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "test/**/*.ts"],
  "exclude": ["scripts/bundle/**"],
  "references": [{ "path": "./tsconfig.node.json" }]
}

@ExistentialAlex
Copy link
Author

Found the issue! The problem was the declarationDir in my tsconfig. :)

@qmhc qmhc added the bug Something isn't working label Aug 6, 2023
qmhc added a commit that referenced this issue Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants