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] Error exporting from picocolors #842

Closed
bambuk6 opened this issue Sep 7, 2024 · 1 comment
Closed

[Bug] Error exporting from picocolors #842

bambuk6 opened this issue Sep 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bambuk6
Copy link

bambuk6 commented Sep 7, 2024

Using gulp5-sass-plugin@2.0.2

file:///<path>/frontend/node_modules/gulp5-sass-plugin/dist/index.js:1
import{basename as B,extname as E,dirname as g,relative as d}from"node:path";import{Transform as T}from"node:stream";import{fileURLToPath as b}from"node:url";import{underline as j}from"picocolors";import n from"plugin-error";import i from"replace-ext";import{compileString as A,compileStringAsync as F}from"sass";import O from"strip-ansi";import W from"vinyl-sourcemaps-apply";const v="gulp5-sass-plugin",w=(t,a)=>{if(a.sourceMap){const e=a.sourceMap,m=t.relative;e.sources=e.sources.map(r=>r.startsWith("data:")?t.relative:d(g(t.path),b(r))),e.file=i(m,".css"),W(t,e)}return t.contents=Buffer.from(a.css),t.path=i(t.path,".css"),t.stat&&(t.stat.atime=t.stat.mtime=t.stat.ctime=new Date),t},S=(t={},a)=>new T({objectMode:!0,transform(e,m,r){const o={...t};if(e.isNull())return r(null,e);if(e.isStream())return r(new n(v,"Streaming not supported"));if(e.isBuffer()){if(B(e.path).startsWith("_"))return r();if(!e.contents.length)return e.path=i(e.path,".css"),r(null,e);const p=e.contents.toString();E(e.path)===".sass"&&(o.syntax="indented"),o.loadPaths||(o.loadPaths=[]),o.loadPaths.unshift(g(e.path)),e.sourceMap&&(o.sourceMap=!0);const c=s=>{var l,u;const x=(u=(l=s.span)==null?void 0:l.url)!=null&&u.pathname?s.span.url.pathname:e.path,f=d(process.cwd(),x),h=[j(f),s.sassMessage].join(`
                                                                                                                                                                     ^^^^^^^^^
SyntaxError: Named export 'underline' not found. The requested module 'picocolors' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'picocolors';
const {basename: B,extname: E,dirname: g,relative: d}from"node:path";import{Transform: T}from"node:stream";import{fileURLToPath: b}from"node:url";import{underline: j}from"picocolors";import n from"plugin-error";import i from"replace-ext";import{compileString: A,compileStringAsync: F}from"sass";import O from"strip-ansi";import W from"vinyl-sourcemaps-apply";const v="gulp5-sass-plugin",w=(t,a)=>{if(a.sourceMap){const e=a.sourceMap,m=t.relative;e.sources=e.sources.map(r=>r.startsWith("data:")?t.relative:d(g(t.path),b(r))),e.file=i(m,".css"),W(t,e)}return t.contents=Buffer.from(a.css),t.path=i(t.path,".css"),t.stat&&(t.stat.atime=t.stat.mtime=t.stat.ctime=new Date),t},S=(t={},a)=>new T({objectMode:!0,transform(e,m,r){const o={...t} = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:146:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:229:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
@bambuk6 bambuk6 added the bug Something isn't working label Sep 7, 2024
tuespetre added a commit to tuespetre/gulp5-sass-plugin that referenced this issue Sep 24, 2024
@tuespetre
Copy link

temporary workaround:
import { sass } from './node_modules/gulp5-sass-plugin/dist/index.cjs';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants