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

🐛 BUG: Circular dependency fix broke starting up with some packages #3682

Open
1 task done
canderis opened this issue Aug 25, 2021 · 16 comments
Open
1 task done

Comments

@canderis
Copy link

canderis commented Aug 25, 2021

Quick checklist

  • I am using the latest version of Snowpack and all plugins.

What package manager are you using?

npm

What operating system are you using?

macOS

Describe the bug

The PR #3562 seems to have caused some issues with both the package Nivo it was trying to fix, as well as others.

A lot of errors similar to this pop up:

[14:28:42] [snowpack] Error: ENOENT: no such file or directory, open 'dir/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/get.js'
[14:28:42] [snowpack] [500] /_snowpack/pkg/lodash.get.v4.17.21.js
[14:28:42] [snowpack] [Error: ENOENT: no such file or directory, open 'dir/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/set.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'dir/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/set.js'
}

As well as a lot of these:

[14:27:29] [snowpack] lodash/isDate: Unscannable package import found.
Snowpack scans source files for package imports at startup, and on every change.
But, sometimes an import gets added during the build process, invisible to our file scanner.
We'll prepare this package for you now, but should add "lodash/isDate" to "knownEntrypoints"
in your config file so that this gets prepared with the rest of your imports during startup.

though I only included lodash in this list, the same sort of errors come up from other packages.

I believe it has something to do with having two packages that require two different versions of another package but I'm not entirely sure.

Steps to reproduce

  1. npx create-snowpack-app my-app --template @snowpack/app-template-react-typescript
  2. npm i @nivo/core @nivo/bar
  3. Replace App.tsx with
import { ResponsiveBar } from '@nivo/bar';
import React from 'react';
import './App.css';

const data = [
  {
    country: 'AD',
    'hot dog': 3,
    'hot dogColor': 'hsl(183, 70%, 50%)',
    burger: 42,
    burgerColor: 'hsl(253, 70%, 50%)',
    sandwich: 167,
    sandwichColor: 'hsl(154, 70%, 50%)',
    kebab: 169,
    kebabColor: 'hsl(166, 70%, 50%)',
    fries: 65,
    friesColor: 'hsl(288, 70%, 50%)',
    donut: 120,
    donutColor: 'hsl(83, 70%, 50%)',
  },
  {
    country: 'AE',
    'hot dog': 168,
    'hot dogColor': 'hsl(20, 70%, 50%)',
    burger: 119,
    burgerColor: 'hsl(69, 70%, 50%)',
    sandwich: 113,
    sandwichColor: 'hsl(350, 70%, 50%)',
    kebab: 127,
    kebabColor: 'hsl(207, 70%, 50%)',
    fries: 7,
    friesColor: 'hsl(196, 70%, 50%)',
    donut: 107,
    donutColor: 'hsl(267, 70%, 50%)',
  },
  {
    country: 'AF',
    'hot dog': 179,
    'hot dogColor': 'hsl(98, 70%, 50%)',
    burger: 110,
    burgerColor: 'hsl(229, 70%, 50%)',
    sandwich: 144,
    sandwichColor: 'hsl(355, 70%, 50%)',
    kebab: 46,
    kebabColor: 'hsl(75, 70%, 50%)',
    fries: 105,
    friesColor: 'hsl(34, 70%, 50%)',
    donut: 25,
    donutColor: 'hsl(86, 70%, 50%)',
  },
  {
    country: 'AG',
    'hot dog': 169,
    'hot dogColor': 'hsl(253, 70%, 50%)',
    burger: 61,
    burgerColor: 'hsl(241, 70%, 50%)',
    sandwich: 83,
    sandwichColor: 'hsl(241, 70%, 50%)',
    kebab: 168,
    kebabColor: 'hsl(104, 70%, 50%)',
    fries: 77,
    friesColor: 'hsl(328, 70%, 50%)',
    donut: 97,
    donutColor: 'hsl(76, 70%, 50%)',
  },
  {
    country: 'AI',
    'hot dog': 10,
    'hot dogColor': 'hsl(15, 70%, 50%)',
    burger: 144,
    burgerColor: 'hsl(100, 70%, 50%)',
    sandwich: 34,
    sandwichColor: 'hsl(238, 70%, 50%)',
    kebab: 26,
    kebabColor: 'hsl(327, 70%, 50%)',
    fries: 44,
    friesColor: 'hsl(107, 70%, 50%)',
    donut: 40,
    donutColor: 'hsl(218, 70%, 50%)',
  },
  {
    country: 'AL',
    'hot dog': 60,
    'hot dogColor': 'hsl(52, 70%, 50%)',
    burger: 189,
    burgerColor: 'hsl(151, 70%, 50%)',
    sandwich: 130,
    sandwichColor: 'hsl(246, 70%, 50%)',
    kebab: 171,
    kebabColor: 'hsl(11, 70%, 50%)',
    fries: 1,
    friesColor: 'hsl(160, 70%, 50%)',
    donut: 190,
    donutColor: 'hsl(35, 70%, 50%)',
  },
  {
    country: 'AM',
    'hot dog': 125,
    'hot dogColor': 'hsl(80, 70%, 50%)',
    burger: 105,
    burgerColor: 'hsl(57, 70%, 50%)',
    sandwich: 10,
    sandwichColor: 'hsl(63, 70%, 50%)',
    kebab: 13,
    kebabColor: 'hsl(135, 70%, 50%)',
    fries: 62,
    friesColor: 'hsl(157, 70%, 50%)',
    donut: 38,
    donutColor: 'hsl(36, 70%, 50%)',
  },
];
interface AppProps {}

function App({}: AppProps) {
  return (
    <div className="App">
      <ResponsiveBar
        data={data}
        keys={['hot dog', 'burger', 'sandwich', 'kebab', 'fries', 'donut']}
        indexBy="country"
        margin={{ top: 50, right: 130, bottom: 50, left: 60 }}
        padding={0.3}
        valueScale={{ type: 'linear' }}
        indexScale={{ type: 'band', round: true }}
        colors={{ scheme: 'nivo' }}
        defs={[
          {
            id: 'dots',
            type: 'patternDots',
            background: 'inherit',
            color: '#38bcb2',
            size: 4,
            padding: 1,
            stagger: true,
          },
          {
            id: 'lines',
            type: 'patternLines',
            background: 'inherit',
            color: '#eed312',
            rotation: -45,
            lineWidth: 6,
            spacing: 10,
          },
        ]}
        fill={[
          {
            match: {
              id: 'fries',
            },
            id: 'dots',
          },
          {
            match: {
              id: 'sandwich',
            },
            id: 'lines',
          },
        ]}
        borderColor={{ from: 'color', modifiers: [['darker', 1.6]] }}
        axisTop={null}
        axisRight={null}
        axisBottom={{
          tickSize: 5,
          tickPadding: 5,
          tickRotation: 0,
          legend: 'country',
          legendPosition: 'middle',
          legendOffset: 32,
        }}
        axisLeft={{
          tickSize: 5,
          tickPadding: 5,
          tickRotation: 0,
          legend: 'food',
          legendPosition: 'middle',
          legendOffset: -40,
        }}
        labelSkipWidth={12}
        labelSkipHeight={12}
        labelTextColor={{ from: 'color', modifiers: [['darker', 1.6]] }}
        legends={[
          {
            dataFrom: 'keys',
            anchor: 'bottom-right',
            direction: 'column',
            justify: false,
            translateX: 120,
            translateY: 0,
            itemsSpacing: 2,
            itemWidth: 100,
            itemHeight: 20,
            itemDirection: 'left-to-right',
            itemOpacity: 0.85,
            symbolSize: 20,
            effects: [
              {
                on: 'hover',
                style: {
                  itemOpacity: 1,
                },
              },
            ],
          },
        ]}
      />
    </div>
  );
}

export default App;
  1. npm run start

Link to minimal reproducible example (optional)

No response

@canderis canderis changed the title 🐛 BUG: Circular dependency fix broke 🐛 BUG: Circular dependency fix broke starting up with some packages Aug 25, 2021
@klanthier
Copy link

Confirm I upgraded Snowpack to latest version and I am running in with the same issue

@AlexMoutonNoble
Copy link

AlexMoutonNoble commented Aug 26, 2021

one more. seeing it in 3.8.8 and as far back as 3.8.5?

@canderis
Copy link
Author

canderis commented Aug 26, 2021

Can confirm this is still happening on 3.8.8

[14:23:50] [snowpack] + @nivo/bar@0.73.1
[14:23:51] [snowpack] └── @nivo/axes@0.73.0
[14:23:51] [snowpack]   └── react@17.0.2 (dedupe)
[14:23:51] [snowpack]     └── object-assign@4.1.1
[14:23:51] [snowpack]   └── @react-spring/web@9.2.4
[14:23:51] [snowpack]     └── @react-spring/core@9.2.4
[14:23:52] [snowpack]       └── @react-spring/shared@9.2.4
[14:23:52] [snowpack]         └── @react-spring/rafz@9.2.4
[14:23:52] [snowpack]       └── @react-spring/animated@9.2.4
[14:23:52] [snowpack]       └── @react-spring/types/animated@9.2.4
[14:23:52] [snowpack]       └── @react-spring/types/interpolation@9.2.4
[14:23:52] [snowpack]     └── react-dom@17.0.2 (dedupe)
[14:23:55] [snowpack]       └── scheduler@0.20.2
[14:23:55] [snowpack]       └── scheduler/tracing@0.20.2
[14:23:55] [snowpack]   └── @nivo/core@0.73.0
[14:23:55] [snowpack]     └── @nivo/tooltip@0.73.0
[14:23:55] [snowpack]       └── @nivo/core@0.73.0 (dedupe)
[14:23:55] [snowpack]         └── @nivo/tooltip@0.73.0 (dedupe)
[14:23:55] [snowpack]         └── prop-types@15.7.2
[14:23:55] [snowpack]           └── react-is@16.13.1
[14:23:56] [snowpack]         └── lodash/merge@4.17.21
[14:23:56] [snowpack]         └── lodash/get@4.17.21
[14:23:57] [snowpack]         └── lodash/set@4.17.21
[14:23:58] [snowpack]         └── d3-interpolate@2.0.1
[14:23:58] [snowpack]           └── d3-color@2.0.0
[14:23:58] [snowpack]         └── lodash/isString@4.17.21
[14:23:59] [snowpack]         └── react/jsx-runtime@17.0.2
[14:23:59] [snowpack]         └── lodash/last@4.17.21
[14:24:00] [snowpack]         └── lodash/isArray@4.17.21
[14:24:01] [snowpack]         └── d3-scale@3.3.0
[14:24:01] [snowpack]           └── d3-array@2.12.1
[14:24:01] [snowpack]             └── internmap@1.0.1
[14:24:01] [snowpack]           └── d3-format@2.0.0
[14:24:01] [snowpack]           └── d3-time@2.1.1
[14:24:01] [snowpack]           └── d3-time-format@3.0.0
[14:24:02] [snowpack]         └── d3-scale-chromatic@2.0.0
[14:24:02] [snowpack]         └── lodash/isFunction@4.17.21
[14:24:03] [snowpack]         └── lodash/without@4.17.21
[14:24:04] [snowpack]         └── d3-shape@1.3.7
[14:24:04] [snowpack]           └── d3-path@1.0.9
[14:24:04] [snowpack]         └── d3-hierarchy@1.1.9
[14:24:04] [snowpack]         └── d3-format@1.4.5
[14:24:04] [snowpack]         └── @nivo/recompose@0.73.0
[14:24:05] [snowpack]           └── react-lifecycles-compat@3.0.4
[14:24:05] [snowpack]         └── lodash/isEqual@4.17.21
[14:24:06] [snowpack]         └── lodash/isPlainObject@4.17.21
[14:24:08] [snowpack]         └── lodash/pick@4.17.21
[14:24:09] [snowpack]   └── d3-time@1.1.0
[14:24:09] [snowpack]   └── d3-format@1.4.5 (dedupe)
[14:24:09] [snowpack] └── @nivo/annotations@0.73.0
[14:24:10] [snowpack] └── @nivo/legends@0.73.0
[14:24:10] [snowpack] └── @nivo/scales@0.73.0
[14:24:10] [snowpack] └── lodash/uniqBy@4.17.21
[14:24:12] [snowpack] └── @nivo/colors@0.73.0
[14:24:12] [snowpack]   └── react-motion@0.5.2
[14:24:12] [snowpack]     └── performance-now@0.2.0
[14:24:12] [snowpack]     └── raf@3.4.1
[14:24:12] [snowpack]       └── performance-now@2.1.0
[14:24:13] [snowpack] Ready!
! Port 8080 not available. Run on port 8081 instead? (Y/n) y
[14:33:37] [snowpack] Server started in 22ms.
[14:33:37] [snowpack] Local: http://localhost:8081
[14:33:37] [snowpack] Network: http://192.168.1.118:8081
[14:33:37] [@snowpack/plugin-typescript] 1:32:37 PM - Starting compilation in watch mode...
[14:33:39] [snowpack] lodash/omit: Unscannable package import found.
Snowpack scans source files for package imports at startup, and on every change.
But, sometimes an import gets added during the build process, invisible to our file scanner.
We'll prepare this package for you now, but should add "lodash/omit" to "knownEntrypoints"
in your config file so that this gets prepared with the rest of your imports during startup.
[14:33:39] [snowpack] lodash/isNumber: Unscannable package import found.
Snowpack scans source files for package imports at startup, and on every change.
But, sometimes an import gets added during the build process, invisible to our file scanner.
We'll prepare this package for you now, but should add "lodash/isNumber" to "knownEntrypoints"
in your config file so that this gets prepared with the rest of your imports during startup.
[14:33:39] [snowpack] lodash/filter: Unscannable package import found.
Snowpack scans source files for package imports at startup, and on every change.
But, sometimes an import gets added during the build process, invisible to our file scanner.
We'll prepare this package for you now, but should add "lodash/filter" to "knownEntrypoints"
in your config file so that this gets prepared with the rest of your imports during startup.
[14:33:39] [snowpack] + lodash/omit@4.17.21
[14:33:40] [snowpack] + lodash/isNumber@4.17.21
[14:33:42] [snowpack] + lodash/filter@4.17.21
[14:33:43] [@snowpack/plugin-typescript] 1:32:43 PM - Found 0 errors. Watching for file changes.
[14:33:43] [snowpack] lodash/uniq: Unscannable package import found.
Snowpack scans source files for package imports at startup, and on every change.
But, sometimes an import gets added during the build process, invisible to our file scanner.
We'll prepare this package for you now, but should add "lodash/uniq" to "knownEntrypoints"
in your config file so that this gets prepared with the rest of your imports during startup.
[14:33:43] [snowpack] lodash/sortBy: Unscannable package import found.
Snowpack scans source files for package imports at startup, and on every change.
But, sometimes an import gets added during the build process, invisible to our file scanner.
We'll prepare this package for you now, but should add "lodash/sortBy" to "knownEntrypoints"
in your config file so that this gets prepared with the rest of your imports during startup.
[14:33:43] [snowpack] lodash/isDate: Unscannable package import found.
Snowpack scans source files for package imports at startup, and on every change.
But, sometimes an import gets added during the build process, invisible to our file scanner.
We'll prepare this package for you now, but should add "lodash/isDate" to "knownEntrypoints"
in your config file so that this gets prepared with the rest of your imports during startup.
[14:33:43] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/uniqBy.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/uniqBy.js'
}
[14:33:43] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/uniqBy.js'
[14:33:43] [snowpack] [500] /_snowpack/pkg/lodash.uniqBy.v4.17.21.js
[14:33:43] [snowpack] + lodash/uniq@4.17.21
[14:33:45] [snowpack] + lodash/sortBy@4.17.21
[14:33:47] [snowpack] + lodash/isDate@4.17.21
[14:33:49] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/merge.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/merge.js'
}
[14:33:49] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/merge.js'
[14:33:49] [snowpack] [500] /_snowpack/pkg/lodash.merge.v4.17.21.js
[14:33:49] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/get.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/get.js'
}
[14:33:49] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/get.js'
[14:33:49] [snowpack] [500] /_snowpack/pkg/lodash.get.v4.17.21.js
[14:33:49] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/set.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/set.js'
}
[14:33:49] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/set.js'
[14:33:49] [snowpack] [500] /_snowpack/pkg/lodash.set.v4.17.21.js
[14:33:50] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isString.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isString.js'
}
[14:33:50] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isString.js'
[14:33:50] [snowpack] [500] /_snowpack/pkg/lodash.isString.v4.17.21.js
[14:33:50] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/last.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/last.js'
}
[14:33:50] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/last.js'
[14:33:50] [snowpack] [500] /_snowpack/pkg/lodash.last.v4.17.21.js
[14:33:50] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isArray.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isArray.js'
}
[14:33:50] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isArray.js'
[14:33:50] [snowpack] [500] /_snowpack/pkg/lodash.isArray.v4.17.21.js
[14:33:50] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isFunction.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isFunction.js'
}
[14:33:50] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isFunction.js'
[14:33:50] [snowpack] [500] /_snowpack/pkg/lodash.isFunction.v4.17.21.js
[14:33:50] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/without.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/without.js'
}
[14:33:50] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/without.js'
[14:33:50] [snowpack] [500] /_snowpack/pkg/lodash.without.v4.17.21.js
[14:33:50] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isPlainObject.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isPlainObject.js'
}
[14:33:50] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isPlainObject.js'
[14:33:50] [snowpack] [500] /_snowpack/pkg/lodash.isPlainObject.v4.17.21.js
[14:33:50] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isEqual.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isEqual.js'
}
[14:33:50] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/isEqual.js'
[14:33:50] [snowpack] [500] /_snowpack/pkg/lodash.isEqual.v4.17.21.js
[14:33:50] [snowpack] [Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/pick.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/pick.js'
}
[14:33:50] [snowpack] Error: ENOENT: no such file or directory, open '/Users/user/Documents/working/import-bug/node_modules/.cache/snowpack/build/lodash@4.17.21/lodash/pick.js'
[14:33:50] [snowpack] [500] /_snowpack/pkg/lodash.pick.v4.17.21.js
[14:33:57] [snowpack] Error: Parse error @:243:37
    at parse (/Users/user/Documents/working/import-bug/node_modules/snowpack/node_modules/es-module-lexer/dist/lexer.cjs:1:402)
    at Object.scanCodeImportsExports (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/rewrite-imports.js:21:29)
    at /Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:587:59
    at async PackageSourceLocal.buildPackageImport (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:454:30)
    at async PackageSourceLocal.resolvePackageImport (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:691:9)
    at async resolveImport (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:303:20)
    at async /Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:306:37
    at async /Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/rewrite-imports.js:47:31
    at async Promise.all (index 2)
    at async transformEsmImports (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/rewrite-imports.js:39:5) {
  idx: 8323
}
[14:33:57] [snowpack] Error: Parse error @:243:37
[14:33:57] [snowpack] [500] /_snowpack/pkg/@nivo.scales.v0.73.0.js
[14:33:57] [snowpack] Error: Parse error @:648:22
    at parse (/Users/user/Documents/working/import-bug/node_modules/snowpack/node_modules/es-module-lexer/dist/lexer.cjs:1:402)
    at Object.scanCodeImportsExports (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/rewrite-imports.js:21:29)
    at /Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:587:59
    at async PackageSourceLocal.buildPackageImport (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:454:30)
    at async PackageSourceLocal.resolvePackageImport (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:691:9)
    at async resolveImport (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:303:20)
    at async /Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/sources/local.js:306:37
    at async /Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/rewrite-imports.js:47:31
    at async Promise.all (index 1)
    at async transformEsmImports (/Users/user/Documents/working/import-bug/node_modules/snowpack/lib/cjs/rewrite-imports.js:39:5) {
  idx: 18827
}
[14:33:57] [snowpack] Error: Parse error @:648:22
[14:33:57] [snowpack] [500] /_snowpack/pkg/@nivo.annotations.v0.73.0.js

@Porges
Copy link

Porges commented Sep 6, 2021

Seeing this also on 3.8.8, trying to use react-bootstrap:

Error: ENOENT: no such file or directory, open '…/node_modules/.cache/snowpack/build/@restart/hooks@0.3.27/common/_commonjsHelpers-913f9c4a.js'

The @restart directory exists but there is nothing inside it.

Repro:

npm init astro # select starter kit, react
npm install react-bootstrap --save
# add to src/pages/index.astro: import { Container } from 'react-bootstrap';
npm start
# browse to localhost:3000

@IceSentry
Copy link

I want to also point out that I added the offending packages in the knownEntrypoints array like the warning suggests and the message still shows up.

@rajasegar-c
Copy link

Any workaround folks, like should we downgrade snowpack to an older version?

@IceSentry
Copy link

I just ignore it, the warning is only in dev mode but when actually building there's no warning.

@Porges
Copy link

Porges commented Sep 15, 2021

I just ignore it, the warning is only in dev mode but when actually building there's no warning.

It crashes out, it’s not just a warning…

@IceSentry
Copy link

Right, I was only affected by the warnings which is only half of the issue.

@canderis
Copy link
Author

I had to downgrade because this broke my existing project as is, and the only reason I have to upgrade--Nivo--still will not work even in this minimal example project.

I know I saw somewhere there was a test specifically to run a project with Nivo but I've been unable to get any barebones project running with that package so I'm not quite sure how it is supposed to function or if there's some configuration I'm missing.

I am entirely blocked from upgrading because of this bug, even without Nivo.

@gerarts
Copy link

gerarts commented Oct 12, 2021

Rolling snowpack back to ~3.7.0 seems to have fixed this issue for me. Still happening on 3.8.x.

@gerarts
Copy link

gerarts commented Nov 16, 2021

OK Ver DLs (7d) Age Comment
3.8.8 12,296 3 mo Unscannable package import found. + 500 err /_snowpack/pkg/...
3.8.7 44 3 mo Unscannable package import found. + 500 err /_snowpack/pkg/...
3.8.6 1,644 3 mo
3.8.5 2 3 mo Not found on files in the /_snowpack/pkg/ dir
⚠️ 3.8.4 2 3 mo Install err: Wrong skypack version
3.8.3 723 4 mo
3.8.2 191 4 mo
3.8.1 2 4 mo
3.8.0 25 4 mo
3.7.1 827 5 mo

It seems to break in the first rc for 3.8.7 which was accidentally named snowpack-3.8.6-rc.0 and then republished as snowpack-3.8.7-rc.0, and subsequently published as 3.8.7 without any changes since snowpack-3.8.6-rc.0. This was a fix by @drwpow for a circular dependency loop issue but seems to have broken some other stuff.

I did a quick scan on the changes between 3.8.6 and 3.8.7. I have a hunch that the issue is caused by something in snowpack/src/sources/local.ts, probably something with the memoization stuff.

There are also some changes in the init command, but this is just a package.json exists check.

Can anyone confirm that 3.8.6 works for them?

@jonkoops
Copy link

@gerarts I can confirm that 3.8.6 works for us and that newer versions break our build (see: keycloak/keycloak-ui#1344).

@bentorkington
Copy link

Thanks @gerarts, 3.8.6 is working for me too

@ca-d
Copy link

ca-d commented Jun 16, 2022

#3859 looks like a simple, straight forward fix for this without any complications.

@FredKSchott what's currently keeping you from merging it? Can I help with that PR in some way?

@gustavoiosimura
Copy link

I downgraded it to 3.8.6 and I can't believe it worked... I was stucked at this problem.
You're the Goat man!
Thank you so much..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.