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

Is it work with svg.js 3.0 ? #50

Open
VitaliyAT opened this issue Jun 5, 2020 · 2 comments
Open

Is it work with svg.js 3.0 ? #50

VitaliyAT opened this issue Jun 5, 2020 · 2 comments

Comments

@VitaliyAT
Copy link

VitaliyAT commented Jun 5, 2020

Draw line, add first filter in example

image.filterWith(function(add) {
  add.gaussianBlur(30)
})

IF Put it (svg.filter.js) in html after svg.js AS IS:

<script src="js/svg.js"></script>
<script src="js/svg.filter.js"></script>

THEN
But get in console:

Uncaught SyntaxError: Cannot use import statement outside a module

ELSIF AS IS (type="module" added):

<script src="js/svg.js"></script>
<script type="module" src="js/svg.filter.js"></script>

THEN

Uncaught TypeError: Failed to resolve module specifier "@svgdotjs/svg.js". Relative references must start with either "/", "./", or "../".

"@svgdotjs/svg.js" installed through npm as:

npm i @svgdotjs/svg.js --save-def

"@svgdotjs/svg.filter.js" installed as:

npm i @svgdotjs/svg.filter.js --save-def

"dependencies": {
    "@svgdotjs/svg.js": "^3.0.16",
    "@svgdotjs/svg.filter.js": "^3.0.7"
  }
@VitaliyAT
Copy link
Author

VitaliyAT commented Jun 5, 2020

Short answer: Yes, it's work.
Long answer:

  1. Go to https://github.com/svgdotjs/svg.filter.js/releases
  2. Download zip, open, take "min" version
  3. Use "min" version in project.
  4. Get clear console.

Tested - it's work.
Don't know why so, why errors with full version.
Don't understand how npm installation can help.
Don't understand why in readme.md have no such information - just 1 npm's line and "think what you want and use it somehow, how you don't know". Why it's a secret? Why so not welcome?
Don't see any button in github from project to releases. Only direct typing URL (as higher) give me releases.

I am working under localhost:3000 server organized through "browser-sync". Project should do the same - it's not web site, it's web face for PLC. That's why I need all from localhost. But anyway it's does not mater from what point it will work. Look on facts: full version not work. By the way, svg.path.js - work OK from localhost and full version. Why svg.filter.js is not?

@Fuzzyma
Copy link
Member

Fuzzyma commented Jun 5, 2020

Its there:

Unbenannt

The file you include via script tag is a bundled (generated) file. There is no value in putting it into the source code because its not source. Therefore it is published as release AND published with npm. It is common among libraries to populate their distribution files in the folder "dist". So when you install this package via npm or yarn you will find the bundled files in the dist folder of the svg.filter.js package.

svg.path.js is not maintained by me. It depends on a global variable SVG which is NOT available when you use esm imports. So yes, it works for you (which is the "old" way) but not for users using esm imports

Why it's a secret? Why so not welcome?

Feel free to improve. I am a single person maintaining more than 10 repos and a documentation. I have only so much spare time at my hand and cant possibly see everything. Thats why it is open source. Everyone can help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants