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

TypeError: Cannot read properties of undefined (reading 'pop') - when importing sass #2017

Closed
spence-s opened this issue Jun 14, 2023 · 0 comments · Fixed by google/dart_cli_pkg#132
Assignees
Labels

Comments

@spence-s
Copy link

spence-s commented Jun 14, 2023

This is for the npm version of sass - 1.63.4

I have an esm file like this:

import sass from 'sass'

() => {
  const webpackConfig = await import('./other-file');
}

other-file.js is a cjs file:

const sass = require('sass')

other-file throws an error:

TypeError: Cannot read properties of undefined (reading 'pop')
    at Object.<anonymous> (/Users/path/to/node_modules/sass/sass.node.js:2:43)

It seems like its a problem with importing the package more than one time.

The setup here looks weird, but the reason is that the CJS file is our production build file, which we want to avoid doing experimental things with, and the esm file is our development build fill and I think this is a valid use case/bug.

reproducible stack-blitz: https://stackblitz.com/edit/stackblitz-starters-wm1r15?file=index.mjs

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

Successfully merging a pull request may close this issue.

2 participants