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

Uncaught ReferenceError: require is not defined (vendor.js) #5924

Closed
7 tasks done
l1x opened this issue Dec 1, 2021 · 2 comments
Closed
7 tasks done

Uncaught ReferenceError: require is not defined (vendor.js) #5924

l1x opened this issue Dec 1, 2021 · 2 comments

Comments

@l1x
Copy link

l1x commented Dec 1, 2021

Describe the bug

Uncaught ReferenceError: require is not defined
at vendor.75daa434.js:64

var Kd=require("./generated/16px/paths"),
Yd=require("./generated/20px/paths")

Screenshot 2021-12-01 at 19 59 42

Reproduction

I have created a repo with minimal amount of code and it is easy to reproduce.

https://github.com/DataDeft/web-debug

I am not sure if this is a Vite bug or a 3rd party bug.

System Info

System:
    OS: macOS 11.5.2
    CPU: (8) arm64 Apple M1
    Memory: 176.91 MB / 16.00 GB
    Shell: 3.3.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 14.18.1 - /opt/homebrew/opt/node@14/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.0 - /opt/homebrew/bin/npm
  Browsers:
    Brave Browser: 96.1.32.113
    Safari: 15.0
  npmPackages:
    @vitejs/plugin-react: ^1.1.0 => 1.1.0
    vite: ^2.6.14 => 2.6.14

Used Package Manager

yarn

Logs

> yarn build --debug
yarn run v1.22.17
warning package.json: No license field
$ vite build --debug
  vite:config bundled config file loaded in 63.39ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'alias',
  vite:config     'vite:react-babel',
  vite:config     'vite:react-refresh',
  vite:config     'vite:react-jsx',
  vite:config     'vite:modulepreload-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html-inline-script-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:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  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:build-import-analysis',
  vite:config     'vite:esbuild-transpile',
  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   resolve: { dedupe: [ 'react', 'react-dom' ], alias: [ [Object], [Object] ] },
  vite:config   optimizeDeps: {
  vite:config     include: [ 'react/jsx-dev-runtime' ],
  vite:config     esbuildOptions: { keepNames: undefined, preserveSymlinks: undefined }
  vite:config   },
  vite:config   configFile: '/Users/l1x/code/datadeft/web-debug/vite.config.ts',
  vite:config   configFileDependencies: [ '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/l1x/code/datadeft/web-debug',
  vite:config   base: '/',
  vite:config   publicDir: '/Users/l1x/code/datadeft/web-debug/public',
  vite:config   cacheDir: '/Users/l1x/code/datadeft/web-debug/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   server: { fs: { strict: undefined, allow: [Array] } },
  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   createResolver: [Function: createResolver]
  vite:config } +2ms
vite v2.6.14 building for production...
transforming (183) node_modules/react-popper/lib/esm/utils.js  vite:resolve 0.48ms normalize.css -> /Users/l1x/code/datadeft/web-debug/node_modules/normalize.css/normalize.css +0ms
  vite:resolve 0.40ms @blueprintjs/core/lib/css/blueprint.css -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/core/lib/css/blueprint.css +22ms
transforming (263) node_modules/function-bind/index.js  vite:resolve 0.45ms @blueprintjs/icons/lib/css/blueprint-icons.css -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons.css +166ms
  vite:resolve 0.23ms ./blueprint-icons-16.ttf?2f67a524aaddb5ccc52f7f5137c1478c -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-16.ttf?2f67a524aaddb5ccc52f7f5137c1478c +0ms
  vite:resolve 0.29ms ./blueprint-icons-20.ttf?e086066577b48d9b4bf65fa4949a1f35 -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-20.ttf?e086066577b48d9b4bf65fa4949a1f35 +0ms
  vite:resolve 0.12ms ./blueprint-icons-20.eot?e086066577b48d9b4bf65fa4949a1f35#iefix -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-20.eot?e086066577b48d9b4bf65fa4949a1f35#iefix +1ms
  vite:resolve 0.09ms ./blueprint-icons-16.eot?2f67a524aaddb5ccc52f7f5137c1478c#iefix -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-16.eot?2f67a524aaddb5ccc52f7f5137c1478c#iefix +0ms
  vite:resolve 0.08ms ./blueprint-icons-20.woff2?e086066577b48d9b4bf65fa4949a1f35 -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-20.woff2?e086066577b48d9b4bf65fa4949a1f35 +0ms
  vite:resolve 0.11ms ./blueprint-icons-16.woff2?2f67a524aaddb5ccc52f7f5137c1478c -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-16.woff2?2f67a524aaddb5ccc52f7f5137c1478c +1ms
  vite:resolve 0.08ms ./blueprint-icons-20.woff?e086066577b48d9b4bf65fa4949a1f35 -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-20.woff?e086066577b48d9b4bf65fa4949a1f35 +0ms
  vite:resolve 0.08ms ./blueprint-icons-16.woff?2f67a524aaddb5ccc52f7f5137c1478c -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-16.woff?2f67a524aaddb5ccc52f7f5137c1478c +0ms
  vite:resolve 0.13ms ./blueprint-icons-20.svg?e086066577b48d9b4bf65fa4949a1f35#blueprint-icons-20 -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-20.svg?e086066577b48d9b4bf65fa4949a1f35#blueprint-icons-20 +1ms
  vite:resolve 0.08ms ./blueprint-icons-16.svg?2f67a524aaddb5ccc52f7f5137c1478c#blueprint-icons-16 -> /Users/l1x/code/datadeft/web-debug/node_modules/@blueprintjs/icons/lib/css/blueprint-icons-16.svg?2f67a524aaddb5ccc52f7f5137c1478c#blueprint-icons-16 +0ms
✓ 275 modules transformed.
dist/assets/favicon.63a26457.svg                1.50 KiB
dist/assets/blueprint-icons-20.fe557b90.ttf     69.77 KiB
dist/assets/blueprint-icons-16.b0b014a7.ttf     67.77 KiB
dist/assets/blueprint-icons-20.7029af9a.eot     69.97 KiB
dist/assets/blueprint-icons-16.8a7f65d2.eot     67.97 KiB
dist/assets/blueprint-icons-20.0efaa148.woff2   22.13 KiB
dist/assets/blueprint-icons-16.ab7989dd.woff2   20.37 KiB
dist/assets/blueprint-icons-20.4597403e.woff    29.40 KiB
dist/assets/blueprint-icons-16.0a3122a8.woff    27.66 KiB
dist/assets/blueprint-icons-16.d2b67081.svg     389.60 KiB
dist/assets/blueprint-icons-20.20d8d030.svg     1170.04 KiB
dist/index.html                                 0.53 KiB
dist/assets/index.35d740f4.js                   1.27 KiB / gzip: 0.68 KiB
dist/assets/vendor.75daa434.js                  143.92 KiB / gzip: 47.01 KiB
dist/assets/index.4170818c.css                  363.14 KiB / gzip: 41.24 KiB
✨  Done in 1.55s.

Validations

@l1x
Copy link
Author

l1x commented Dec 1, 2021

We have identified the source of this in BlueprintJS. palantir/blueprint#5054

@Niputi
Copy link
Contributor

Niputi commented Dec 1, 2021

closing as the problem has been identified by users dependency author

@Niputi Niputi closed this as completed Dec 1, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants