leongersen / noUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
https://refreshless.com/nouislider/
MIT License
5.66k stars 659 forks source link

Cannot compile from sources #1173

Closed patriotyk closed 2 years ago

patriotyk commented 2 years ago

I just tried to compile latest(15.5.0) version and got an following error:

patriotyk@patriotyk-Mi-Laptop-Pro-15:~/Downloads/noUiSlider-15.5.0$ npm install

added 211 packages, and audited 212 packages in 2s

2 low severity vulnerabilities

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
patriotyk@patriotyk-Mi-Laptop-Pro-15:~/Downloads/noUiSlider-15.5.0$ npm run build

> nouislider@15.5.0 build
> npm run build:mjs && npm run build:js && npm run build:styles

> nouislider@15.5.0 build:mjs
> tsc --module ES6 && mv dist/nouislider.js dist/nouislider.mjs

> nouislider@15.5.0 build:js
> npm run build:js:write && npm run build:js:compress && npm run build:js:compress:mjs

> nouislider@15.5.0 build:js:write
> rollup -c rollup.config.js

src/nouislider.ts → dist/nouislider.js...
(node:949895) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /home/patriotyk/Downloads/noUiSlider-15.5.0/node_modules/rollup-plugin-typescript2/node_modules/tslib/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
created dist/nouislider.js in 1.4s

> nouislider@15.5.0 build:js:compress
> uglifyjs dist/nouislider.js --compress --mangle --output dist/nouislider.min.js

> nouislider@15.5.0 build:js:compress:mjs
> uglifyjs dist/nouislider.mjs --compress --mangle --output dist/nouislider.min.mjs

Parse error at dist/nouislider.mjs:2,7
export var PipsMode;
       ^
ERROR: Unexpected token: keyword (var)
    at JS_Parse_Error.get (eval at <anonymous> (/home/patriotyk/Downloads/noUiSlider-15.5.0/node_modules/uglify-js/tools/node.js:20:1), <anonymous>:71:23)
    at fatal (/home/patriotyk/Downloads/noUiSlider-15.5.0/node_modules/uglify-js/bin/uglifyjs:291:53)
    at run (/home/patriotyk/Downloads/noUiSlider-15.5.0/node_modules/uglify-js/bin/uglifyjs:235:9)
    at Object.<anonymous> (/home/patriotyk/Downloads/noUiSlider-15.5.0/node_modules/uglify-js/bin/uglifyjs:160:5)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47

patriotyk@patriotyk-Mi-Laptop-Pro-15:~/Downloads/noUiSlider-15.5.0$ npm -v
7.13.0
patriotyk@patriotyk-Mi-Laptop-Pro-15:~/Downloads/noUiSlider-15.5.0$ node -v
v16.2.0
patriotyk@patriotyk-Mi-Laptop-Pro-15:~/Downloads/noUiSlider-15.5.0$ 
leongersen commented 2 years ago

I don't have any immediate pointers as to what's going wrong here, but my first guess is in the node.js versions; I'm still on Node 12 LTS.

andrewstart commented 2 years ago

It looks like updating uglify-js fixes the issue - recent patch notes do mention some work around handing Typescript's enums.

leongersen commented 2 years ago

I've updated the devDependencies. Thank you for contributing!

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.