vitejs / vite

Next generation frontend tooling. It's fast!
http://vitejs.dev
MIT License
67.59k stars 6.09k forks source link

Sourcemap for "X.ts" points to missing source files #7558

Closed michealroberts closed 2 years ago

michealroberts commented 2 years ago

Describe the bug

I currently have the following configuration for my Vite & Vue.js project:

import { defineConfig } from 'vite'

import vue from '@vitejs/plugin-vue'
import WindiCSS from 'vite-plugin-windicss'

import typescript from '@rollup/plugin-typescript'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // https://github.com/antfu/vite-plugin-windicss
    WindiCSS({
      safelist: '',
    }),
    typescript({
        tsconfig: './tsconfig.json'
    }),
    vue()
  ]
})

And on running the following command:

npm run dev -- --host --port 8099

And navigating to localhost:8099 in the browser I am seeing these errors:

Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/main.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/components/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useAdjustedScreen/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useCanvas/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useDimensions/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useCardinals/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useEcliptic/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useInteractions/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useConstellations/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useMoon/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/utils/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useStars/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/composables/useSun/index.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/utils/canvas.ts" points to missing source files
Sourcemap for "/Users/michael/Developer/observerly/aestrium/src/utils/intersectDistance.ts" points to missing source files

Although the app works 100% fine, I believe these are just warnings.

I've looked through the documentation as to why this could be happening, but nothing suggests why. There is a build.sourcemap flag I could add, but no dev.sourcemap (a similar one exists for CSS css.devSourcemap) ...

Reproduction

https://github.com/observerly/aestrium

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 894.11 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.6.0 - /usr/local/bin/node
    npm: 8.5.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 100.0.4896.60
    Firefox: 98.0.2
    Firefox Developer Edition: 99.0
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-vue: ^2.3.1 => 2.3.1 
    vite: ^2.9.1 => 2.9.1

### Used Package Manager

npm

### Logs

```shell
> vue-tsc --noEmit && vite build "--debug"

  vite:config bundled config file loaded in 242.30ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'vite:build-metadata',
  vite:config     'alias',
  vite:config     'vite-plugin-windicss:alias',
  vite:config     'vite-plugin-windicss:groups',
  vite:config     'vite:modulepreload-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html-inline-proxy',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite-plugin-windicss',
  vite:config     'vite-plugin-windicss:css',
  vite:config     'vite-plugin-windicss:css:svelte',
  vite:config     'vite-plugin-windicss:devtools',
  vite:config     'typescript',
  vite:config     'vite:vue',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  vite:config     'vite:worker-import-meta-url',
  vite:config     'vite:watch-package-data',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'rollup-plugin-dynamic-import-variables',
  vite:config     'vite:asset-import-meta-url',
  vite:config     'vite-plugin-windicss:entry',
  vite:config     'vite:build-import-analysis',
  vite:config     'vite:esbuild-transpile',
  vite:config     'vite:terser',
  vite:config     'vite:reporter',
  vite:config     'vite:load-fallback'
  vite:config   ],
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     polyfillModulePreload: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     cssTarget: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     minify: 'esbuild',
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     reportCompressedSize: true,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null,
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] }
  vite:config   },
  vite:config   define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
  vite:config   ssr: { external: [ 'vue', '@vue/server-renderer' ] },
  vite:config   configFile: '/Users/michael/Developer/observerly/aestrium/vite.config.ts',
  vite:config   configFileDependencies: [ '/Users/michael/Developer/observerly/aestrium/vite.config.ts' ],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     build: {}
  vite:config   },
  vite:config   root: '/Users/michael/Developer/observerly/aestrium',
  vite:config   base: '/',
  vite:config   resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
  vite:config   publicDir: '/Users/michael/Developer/observerly/aestrium/public',
  vite:config   cacheDir: '/Users/michael/Developer/observerly/aestrium/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isWorker: false,
  vite:config   isProduction: true,
  vite:config   server: {
  vite:config     preTransformRequests: true,
  vite:config     fs: { strict: true, allow: [Array], deny: [Array] }
  vite:config   },
  vite:config   preview: {
  vite:config     port: undefined,
  vite:config     strictPort: undefined,
  vite:config     host: undefined,
  vite:config     https: undefined,
  vite:config     open: undefined,
  vite:config     proxy: undefined,
  vite:config     cors: undefined,
  vite:config     headers: undefined
  vite:config   },
  vite:config   env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen],
  vite:config     hasErrorLogged: [Function: hasErrorLogged]
  vite:config   },
  vite:config   packageCache: Map(0) { set: [Function (anonymous)] },
  vite:config   createResolver: [Function: createResolver],
  vite:config   optimizeDeps: {
  vite:config     esbuildOptions: { keepNames: undefined, preserveSymlinks: undefined }
  vite:config   },
  vite:config   worker: {
  vite:config     format: 'iife',
  vite:config     plugins: [
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object], [Object], [Object],
  vite:config       [Object]
  vite:config     ],
  vite:config     rollupOptions: {}
  vite:config   }
  vite:config } +120ms
vite v2.9.1 building for production...
✓ 35 modules transformed.
[plugin:typescript] @rollup/plugin-typescript: Rollup 'sourcemap' option must be set to generate source maps.
dist/src/index.d.ts                                 0.11 KiB
dist/src/main.d.ts                                  0.03 KiB
dist/src/components/index.d.ts                      0.07 KiB
dist/src/components/SkyViewer/SkyViewer.d.ts        0.10 KiB
dist/src/composables/index.d.ts                     1.08 KiB
dist/src/composables/useAdjustedScreen/index.d.ts   0.10 KiB
dist/src/composables/useCanvas/index.d.ts           1.07 KiB
dist/src/composables/useCardinals/index.d.ts        1.48 KiB
dist/src/composables/useConstellations/index.d.ts   1.92 KiB
dist/src/composables/useDimensions/index.d.ts       0.46 KiB
dist/src/composables/useEcliptic/index.d.ts         1.64 KiB
dist/src/composables/useInteractions/index.d.ts     0.76 KiB
dist/src/composables/useMoon/index.d.ts             1.81 KiB
dist/src/composables/useStars/index.d.ts            2.16 KiB
dist/src/composables/useSun/index.d.ts              1.69 KiB
dist/src/types/index.d.ts                           0.07 KiB
dist/src/types/SkyViewer/index.d.ts                 1.65 KiB
dist/src/utils/canvas.d.ts                          0.92 KiB
dist/src/utils/index.d.ts                           0.12 KiB
dist/src/utils/intersectDistance.d.ts               0.37 KiB
dist/index.html                                     0.44 KiB
dist/assets/index.efebb9d2.css                      1.77 KiB / gzip: 0.83 KiB
dist/assets/index.9e05da30.js                       343.63 KiB / gzip: 96.98 KiB


### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
michealroberts commented 2 years ago

Is this related to the following PR: PR 7442 ? I have recently updated to the most recent version but I am guessing these changes haven't been added to a release yet?

sapphi-red commented 2 years ago

Your reproduction links to 404. It seems it is a private repository.

michealroberts commented 2 years ago

Your reproduction links to 404. It seems it is a private repository.

Let me know if you want access to it I can add you as temp maintainer.

sapphi-red commented 2 years ago

If it is not a minimal reproducible example, could you create it?

michealroberts commented 2 years ago

If it is not a minimal reproducible example, could you create it?

It's a maximum reproducible example ... i.e., the actual code base with the error.

github-actions[bot] commented 2 years ago

Hello @michael-observerly. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

bluwy commented 2 years ago

@michael-observerly We need a minimal repro so that it's simpler to debug what causes the issue. A full scale app as a repro could introduce a lot of places to look for, making it hard to resolve the issue.

michealroberts commented 2 years ago

@bluwy Ok, I will get a MRE to you. However, there is no Vite + Vue 3 project on Stackblitz out of the box ... do you know of a stable fork to share for Vite version 2.9.1?

michealroberts commented 2 years ago

@bluwy Would you be happy if I started from a template I've just created: https://stackblitz.com/edit/52908eea-914c-4188-9920-784a3a0d8eb3-du2mmh

bluwy commented 2 years ago

The template looks good to me. There is a Vite + Vue 3 template though:

Screenshot 2022-04-01 at 9 45 06 PM
michealroberts commented 2 years ago

Closing this issue as setting the sourceMap flag in tsconfig.json seems to remove the error:

{
    "compilerOptions": {
       "sourceMap": false,
    }
}