vite-plugin-mock icon indicating copy to clipboard operation
vite-plugin-mock copied to clipboard

warning: "esbuild" should be marked as external for use with "require.resolve

Open llyp618 opened this issue 3 years ago • 3 comments

Vite: 2.7.13

vite-plugin-mock: 2.9.6

vite.config:

defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    viteMockServe({
      mockPath: 'mock',
      localEnabled: true,
      prodEnabled: false,
      supportTs: true,
      watchFiles: true,
    }),
  ],
});

Error

node_modules/vite/dist/node/chunks/dep-1412e872.js:2501:6: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)
    2501 │     : require;
         ╵       ~~~~~~~

 > node_modules/vite/dist/node/chunks/dep-1412e872.js:22674:15: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning)
    22674 │         return require(terserPath).minify(code, options);
          ╵                ~~~~~~~

 > node_modules/vite/dist/node/chunks/dep-1412e872.js:71402:16: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning)
    71402 │     const raw = require(fileName);
          ╵                 ~~~~~~~

 > node_modules/vite/dist/node/chunks/dep-1412e872.js:1187:37: warning: "vite/dist/client/client.mjs" should be marked as external for use with "require.resolve"
    1187 │ const CLIENT_ENTRY = require.resolve('vite/dist/client/client.mjs');
         ╵                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > node_modules/vite/dist/node/chunks/dep-1412e872.js:1189:34: warning: "vite/dist/client/env.mjs" should be marked as external for use with "require.resolve"
    1189 │ const ENV_ENTRY = require.resolve('vite/dist/client/env.mjs');

Did i miss any information ?

llyp618 avatar Feb 23 '22 12:02 llyp618

mark

paobai avatar Feb 28 '22 10:02 paobai

please tell me if you find a solution

paobai avatar Feb 28 '22 11:02 paobai

my faults 。in mock files change import { MockMethod } from "vite-plugin-mock" to import type { MockMethod } from "vite-plugin-mock"

paobai avatar Feb 28 '22 12:02 paobai