Skip to content

Code Replace is not a function #33

Description

@mascardoso

I keep getting this issue after trying to use the scss comment parser:

code.replace is not a function
TypeError: code.replace is not a function
    at unifyLineEndings (http://localhost:6060/static/preview.bundle.js:52937:17)
    at CommentExtractor.extract (http://localhost:6060/static/preview.bundle.js:52974:12)
    at Parser.parse (http://localhost:6060/static/preview.bundle.js:52782:28)
    at Object.<anonymous> (http://localhost:6060/static/preview.bundle.js:52253:23)
    at __webpack_require__ (http://localhost:6060/static/preview.bundle.js:677:30)
    at fn (http://localhost:6060/static/preview.bundle.js:88:20)
    at http://localhost:6060/static/preview.bundle.js:41388:10
    at ConfigApi._renderMain (http://localhost:6060/static/preview.bundle.js:46217:20)
    at render (http://localhost:6060/static/preview.bundle.js:46243:17)
    at ConfigApi.configure (http://localhost:6060/static/preview.bundle.js:46268:9)

This is the code I currently have:

const ScssCommentParser = require('scss-comment-parser');

const annotations = {
  _: {
    alias: {
      'aliasTest': 'annotationTest'
    }
  },
  annotationTest: function ( commentLine ) {
    return 'Working';
  }
};

const parser = new ScssCommentParser( annotations );


const scss = require('../front/scss/config.scss')
const comments = parser.parse( scss )

console.log(comments);

Probably I'm doing something wrong but the scss const returns an empty object. Are u loading the scss in a different way?

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions