Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sweet-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 62
    • Issues 62
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • sweet-js
  • sweet-core
  • Issues
  • #751
Closed
Open
Issue created Jul 18, 2018 by brandonmack111@brandonmack111

Import not working

I can use sweet.js fine for most use cases, but any time I try to use imports from standard libraries, it fails to work. Here's an example from the documentation:

import { isStringLiteral } from '@sweet-js/helpers' for syntax;

syntax m = ctx => {
  return isStringLiteral(ctx.next().value) ? #`'a string'` : #`'not a string'`;
};
m 'foo'

the error I get when I try to complie:

evalmachine.<anonymous>:5
    return isStringLiteral(ctx_1.next().value) ? syntaxTemplate(1) : syntaxTemplate(2);
    ^

ReferenceError: isStringLiteral is not defined
    at ctx_1 (evalmachine.<anonymous>:5:5)
    at Enforester.expandMacro (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/enforester.js:1981:87)
    at Enforester.enforestStatement (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/enforester.js:349:12)
    at Enforester.enforestModuleItem (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/enforester.js:136:17)
    at Enforester.enforestBody (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/enforester.js:123:17)
    at Enforester.enforestModule (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/enforester.js:119:17)
    at Enforester.enforest (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/enforester.js:109:21)
    at TokenExpander.expand (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/token-expander.js:133:37)
    at Compiler.compile (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/compiler.js:50:26)
    at NodeLoader.compileSource (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/sweet-loader.js:211:53)
Assignee
Assign to
Time tracking