dougludlow/plugin-sass

SyntaxError: Unexpected identifier

Closed this issue · 4 comments

Preconditions

  • node@5.11.0
  • jspm@0.17.0-beta.12
  • plugin-sass@0.4.3

Given

We have the following in jspm.config.js

SystemJS.config({
  transpiler: "plugin-typescript",
  packages: {
    "ng-kpn-check-box-alpha": {
      "main": "main.ts",
      "defaultExtension": "ts",
      "meta": {
        "*.ts": {
          "loader": "plugin-typescript"
        },
        "*.scss": {
          "loader": "scss"
        }
      }
    }
  }
});

We have a check-box-alpha.scss file within the package which contains the following

.what {
  background-color: red;
}

We have a CheckBoxAlpha.ts file next to the check-box-alpha.scss file with the following

import './check-box-alpha.scss';

Then

In our console we execute the following command

jspm bundle ng-kpn-check-box-alpha storage/build.js

Finally

In our console we see the following error

err  SyntaxError: Unexpected identifier
      at Object.exports.runInThisContext (vm.js:53:16)
  Evaluating /Users/joelhernandez/Documents/KPN/ng-kpn-check-box-alpha/jspm_packages/github/mobilexag/plugin-sass@0.4.3/sass-builder.js
  Error loading /Users/joelhernandez/Documents/KPN/ng-kpn-check-box-alpha/jspm_packages/github/mobilexag/plugin-sass@0.4.3/sass-builder.js
  1. you are using jspm@0.17.0-beta.12 which is not released. It is still a beta and has bugs. Especially for plugins. Please use the latest stable version.
  2. you are importing wrong. Instead of import './check-box-alpha.scss'; you have to do a import './check-box-alpha.scss!';
  3. you are using TypeScript. Please look at #25 for a solution for that. jspm / SystemJS is based on ES5 / ES2015 and TypeScript as an optional plugin which causes issues with that.

Alright, as a sidenote, the issue is raised because with plugin-sass@0.4.0 works, and in regards the importing wrong, this is not necessary with the meta *.scss wildcard on my systemJS config.

Alright, as a sidenote, the issue is raised because with plugin-sass@0.4.0 works

Do you mean plugin-sass? Hm I don't know what the do differently. Maybe we should look and compare it with this repo? Unfortunately I have no experience with TypeScript so I can't help you out with your problem 😕 (I think this error is related to TypeScript because it can't parse my script)

this is not necessary with the meta *.scss wildcard on my systemJS config.

Oh sorry, I oversight that 😔

Nope, with this library, on this release, works,unintentionally, but it does.

I'll look into it and see what made it work before or made it fail now. I know TypeScript might not be a focus of the project but its a good to have for users.