slash icon indicating copy to clipboard operation
slash copied to clipboard

[Feature]: @toss/use-funnel은 next/route를 디펜던시로가지고있어서 CRA, react-route-dom, react 프로젝트에서는 사용할 수 없습니다.

Open Hansanghyeon opened this issue 1 year ago • 2 comments

Package Scope

  • [x] Add to an existing package

Package name: @toss/use-funnel

Overview

내부적으로 next/router에 의존하고 있어 nextjs를 사용하지 않은 프로젝트에서는 사용할수 없습니다.

Describe the solution you'd like

plugin 시스템으로 nextjs로 설정할수도있고 react-router-dom 또한 설정할수있는 퍼널로 되었으면 좋겠습니다.

Additional context

✘ [ERROR] Could not resolve "next/router.js"

    node_modules/@toss/use-funnel/esm/useFunnel.mjs:7:26:
      7 │ import { useRouter } from 'next/router.js';
        ╵                           ~~~~~~~~~~~~~~~~

  You can mark the path "next/router.js" as external to exclude it from the bundle, which will
  remove this error.

✘ [ERROR] Could not resolve "react-query"

    node_modules/@toss/use-funnel/esm/useFunnel.mjs:9:25:
      9 │ import { useQuery } from 'react-query';
        ╵                          ~~~~~~~~~~~~~

  You can mark the path "react-query" as external to exclude it from the bundle, which will remove
  this error.

✘ [ERROR] Could not resolve "next/router"

    node_modules/@toss/use-query-param/esm/hooks/useNextRouter.mjs:1:26:
      1 │ import { useRouter } from 'next/router';
        ╵                           ~~~~~~~~~~~~~

  You can mark the path "next/router" as external to exclude it from the bundle, which will remove
  this error.

✘ [ERROR] Could not resolve "next/router"

    node_modules/@toss/use-query-param/esm/utils/waitForRouterReady.mjs:1:19:
      1 │ import Router from 'next/router';
        ╵                    ~~~~~~~~~~~~~

  You can mark the path "next/router" as external to exclude it from the bundle, which will remove
  this error.

/root/workspace/oms-admin-v3/node_modules/@storybook/cli/bin/index.js:23
  throw error;
  ^

Error: Build failed with 4 errors:
node_modules/@toss/use-funnel/esm/useFunnel.mjs:7:26: ERROR: Could not resolve "next/router.js"
node_modules/@toss/use-funnel/esm/useFunnel.mjs:9:25: ERROR: Could not resolve "react-query"
node_modules/@toss/use-query-param/esm/hooks/useNextRouter.mjs:1:26: ERROR: Could not resolve "next/router"
node_modules/@toss/use-query-param/esm/utils/waitForRouterReady.mjs:1:19: ERROR: Could not resolve "next/router"
    at failureErrorWithLog (/root/workspace/oms-admin-v3/node_modules/esbuild/lib/main.js:1649:15)
    at /root/workspace/oms-admin-v3/node_modules/esbuild/lib/main.js:1058:25
    at /root/workspace/oms-admin-v3/node_modules/esbuild/lib/main.js:1525:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: {
        column: 26,
        file: 'node_modules/@toss/use-funnel/esm/useFunnel.mjs',
        length: 16,
        line: 7,
        lineText: "import { useRouter } from 'next/router.js';",
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: 'You can mark the path "next/router.js" as external to exclude it from the bundle, which will remove this error.'
        }
      ],
      pluginName: '',
      text: 'Could not resolve "next/router.js"'
    },
    {
      detail: undefined,
      id: '',
      location: {
        column: 25,
        file: 'node_modules/@toss/use-funnel/esm/useFunnel.mjs',
        length: 13,
        line: 9,
        lineText: "import { useQuery } from 'react-query';",
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: 'You can mark the path "react-query" as external to exclude it from the bundle, which will remove this error.'
        }
      ],
      pluginName: '',
      text: 'Could not resolve "react-query"'
    },
    {
      detail: undefined,
      id: '',
      location: {
        column: 26,
        file: 'node_modules/@toss/use-query-param/esm/hooks/useNextRouter.mjs',
        length: 13,
        line: 1,
        lineText: "import { useRouter } from 'next/router';",
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: 'You can mark the path "next/router" as external to exclude it from the bundle, which will remove this error.'
        }
      ],
      pluginName: '',
      text: 'Could not resolve "next/router"'
    },
    {
      detail: undefined,
      id: '',
      location: {
        column: 19,
        file: 'node_modules/@toss/use-query-param/esm/utils/waitForRouterReady.mjs',
        length: 13,
        line: 1,
        lineText: "import Router from 'next/router';",
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: 'You can mark the path "next/router" as external to exclude it from the bundle, which will remove this error.'
        }
      ],
      pluginName: '',
      text: 'Could not resolve "next/router"'
    }
  ],
  warnings: []
}

Hansanghyeon avatar Dec 19 '23 05:12 Hansanghyeon

Duplicate of #353

BasixKOR avatar Dec 19 '23 05:12 BasixKOR

아 버그 이슈가 아니라 개선 요청이군요 일단 트래킹용으로 열어둘게요~

BasixKOR avatar Dec 19 '23 05:12 BasixKOR