Giter Site home page Giter Site logo

Comments (7)

lehnerpat avatar lehnerpat commented on July 26, 2024 1

I worked out a temporary work-around for users of rlayers!
I'm sharing this here as-is, without any guarantees or warranties about its correctness. USE AT YOUR OWN RISK.

Put the script below into the root of your project as an .mjs file (e.g. fix-rlayers.mjs), and install the npm packages fs-extra and globby if you don't already have them.
Then run node fix-rlayers.mjs from the root of your project.

You can optionally add a script entry to your package.json if you want, maybe even the postinstall script, which is run automatically after you run npm install; this should help the fix be applied even in a CI environment.

fix-rlayers.mjs:

import fs from "fs-extra";
import { globbySync as globby } from "globby";

process.chdir("node_modules/rlayers");

fs.copySync("src", ".", { recursive: true });
const allMaps = globby("**/*.map");
for (const mapPath of allMaps) {
  const m = fs.readJSONSync(mapPath);
  m["sourceRoot"] = "";
  m["sources"] = m["sources"].map((s) => {
    const parts = s.split("/");
    return parts[parts.length - 1];
  });
  fs.writeJSONSync(mapPath, m);
}

from rlayers.

lehnerpat avatar lehnerpat commented on July 26, 2024

Update: from trying around a bit myself, the quickest fix is changing tsc's sourceRoot and outDir to its default (which is right next to each .ts file), and then just packaging the whole workspace.

tsconfig.json change:

diff --git a/tsconfig.json b/tsconfig.json
index 0250660..c782d8c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,18 +1,16 @@
 {
     "compilerOptions": {
         "sourceMap": true,
-        "sourceRoot": "src",
         "noImplicitAny": false,
         "module": "commonjs",
         "target": "es5",
         "lib": [
             "esnext",
             "dom",
             "dom.iterable"
         ],
-        "outDir": "./dist",
         "declaration": true,
         "declarationMap": true,
         "removeComments": true,
         "allowSyntheticDefaultImports": true,
         "jsx": "react",

This is annoying during development because it clutters your workspace, so some workarounds are probably desirable.

from rlayers.

fogracvxy avatar fogracvxy commented on July 26, 2024
WARNING in ./node_modules/rlayers/style/RText.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\User\Documents\sgisdevelopment\sgis\client\node_modules\rlayers\style\src\style\RText.tsx' file: Error: ENOENT: no such file or directory, open 'C:\Users\user\Documents\sgisdevelopment\sgis\client\node_modules\rlayers\style\src\style\RText.tsx' 

Still getting error after changing tsconfig.json to "inlineSources": true,

from rlayers.

mmomtchev avatar mmomtchev commented on July 26, 2024

You seem to have some 3rd party source map loader installed - it is this loader that generates the message.

I will probably end up completely removing the source maps, as there seem to be various extensions that can read them and given that they are used only for debugging, they are probably of no interest to most of the users.

from rlayers.

fogracvxy avatar fogracvxy commented on July 26, 2024

You seem to have some 3rd party source map loader installed - it is this loader that generates the message.

I will probably end up completely removing the source maps, as there seem to be various extensions that can read them and given that they are used only for debugging, they are probably of no interest to most of the users.

Fixed it using @lehnerpat fix .mjs file.

Keep up the good work!

from rlayers.

mmomtchev avatar mmomtchev commented on July 26, 2024

Can you please test if your tools work with this source map in control/RFullScreen.js.map

{"version":3,"file":"RFullScreen.js","sourceRoot":"rlayers/src/","sources":["control/RFullScreen.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sCAAsC;AAItC,gEAAsE;AAoBtE;IAAyC,+BAAqD;IAG1F,qBAAY,KAAiC,EAAE,OAAoC;QAAnF,YACI,kBAAM,KAAK,EAAE,OAAO,CAAC,SAExB;QADG,KAAI,CAAC,EAAE,GAAG,IAAI,oBAAU,CAAC,KAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;;IACpD,CAAC;IAED,+BAAS,GAAT,UAAU,KAAuB;QAC7B,6BACO,iBAAM,SAAS,YAAC,KAAK,CAAC,KACzB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,IAC5B;IACN,CAAC;IACL,kBAAC;AAAD,CAAC,AAlBD,CAAyC,sBAAY,GAkBpD"}

from rlayers.

mmomtchev avatar mmomtchev commented on July 26, 2024

Should be fixed in 1.3.2

from rlayers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.