Giter Club home page Giter Club logo

Comments (9)

davideicardi avatar davideicardi commented on May 26, 2024 1

The following configurations works fine:

package.json

{
  "name": "test-lpm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "devDependencies": {
    "@types/node": "^13.13.2",
    "typescript": "^3.8.3"
  },
  "dependencies": {
    "live-plugin-manager": "^0.14.1"
  },
  "scripts": {
    "build": "tsc"
  },
  "author": "",
  "license": "ISC"
}

tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "commonjs",
    "strict": true,
    "esModuleInterop": true,
  }
}

index.ts

import {PluginManager} from "live-plugin-manager";
const p = new PluginManager();
p.install('moment')

I have tried with your dependencies and I have the same errors. I suspect that there is some incompatible library. I will try to investigate further...

from live-plugin-manager.

Randgalt avatar Randgalt commented on May 26, 2024 1

Do you need types for these libraries?

Probably not. tbh I'm very new to the Javascript world and am just learning everything. Your plugin manager is fantastic and just what I was looking for but finding the right framework for integrating it has been an issue for me. Frankly the loaders and dev environment are not what I want. I will switch to express and managing things myself along with your plugin manager. That will remove any of these incompatibilities - I'll just get webpack, ts-loader and babel out of the way and rely on pure Javascript for plugins. I can still write my own code in Typescript with tsc.

from live-plugin-manager.

Randgalt avatar Randgalt commented on May 26, 2024

I've worked around much of this.

from live-plugin-manager.

Randgalt avatar Randgalt commented on May 26, 2024

Ah - SO close. I'm down to 1 error and a few warnings. Here's the error:

ERROR in /Users/jordanzimmerman/dev/oss/journalator-electron/journalator/node_modules/live-plugin-manager/src/PluginVm.ts
./node_modules/live-plugin-manager/src/PluginVm.ts
[tsl] ERROR in /Users/jordanzimmerman/dev/oss/journalator-electron/journalator/node_modules/live-plugin-manager/src/PluginVm.ts(189,9)
      TS2740: Type '((requiredName: string) => any) & { resolve: RequireResolve; cache: {}; extensions: RequireExtensions; main: Module | undefined; }' is missing the following properties from type 'NodeRequire': requireActual, requireMock, ensure, context, and 2 more.

This is using ts-loader, "target": "ESNext", "module": "commonjs" and a few other things (I can show you any file you want).

from live-plugin-manager.

Randgalt avatar Randgalt commented on May 26, 2024

Huzzah! I got it working with ts-loader. I had to set transpileOnly: true. I think there's a real bug here. In https://github.com/davideicardi/live-plugin-manager/blob/master/src/PluginVm.ts#L189 you are missing some properties per my comment above (#23 (comment))

from live-plugin-manager.

davideicardi avatar davideicardi commented on May 26, 2024

I will check better, bu I think that depends on the node typings version. I use version 13 in latest release. What version do you have? Can you show your dependencies?

from live-plugin-manager.

Randgalt avatar Randgalt commented on May 26, 2024
  "devDependencies": {
    "@babel/core": "^7.9.6",
    "@babel/plugin-proposal-class-properties": "^7.4.4",
    "@babel/polyfill": "^7.4.4",
    "@babel/preset-env": "^7.9.6",
    "@babel/preset-react": "^7.0.0",
    "@babel/preset-typescript": "^7.3.3",
    "@hot-loader/react-dom": "^16.8.6",
    "@types/electron-devtools-installer": "^2.2.0",
    "@types/jest": "^24.0.13",
    "@types/node": "^13.13.2",
    "@types/react": "^16.8.18",
    "@types/react-dom": "^16.8.4",
    "@types/react-redux": "^7.0.9",
    "@types/react-test-renderer": "^16.8.1",
    "@types/webdriverio": "^4.8.7",
    "@types/webpack-env": "^1.13.3",
    "@typescript-eslint/eslint-plugin": "^2.4.0",
    "@typescript-eslint/parser": "^2.4.0",
    "babel-loader": "^8.1.0",
    "cross-env": "^5.1.3",
    "css-loader": "^2.1.1",
    "electron": "^3.1.9",
    "electron-builder": "^22.3.2",
    "electron-devtools-installer": "^2.2.4",
    "eslint": "^6.5.1",
    "eslint-config-airbnb": "^18.0.1",
    "eslint-config-prettier": "^6.4.0",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-prettier": "^3.1.1",
    "eslint-plugin-react": "^7.16.0",
    "eslint-plugin-react-hooks": "^1.7.0",
    "file-loader": "^3.0.1",
    "fork-ts-checker-webpack-plugin": "^1.3.4",
    "html-webpack-plugin": "^3.2.0",
    "husky": "^4.2.1",
    "image-webpack-loader": "^4.6.0",
    "jest": "^24.8.0",
    "lint-staged": "^10.0.7",
    "node-sass": "^4.12.0",
    "prettier": "^1.18.2",
    "react-hot-loader": "^4.8.8",
    "react-test-renderer": "^16.8.6",
    "redux-devtools-extension": "^2.13.5",
    "sass-loader": "^7.1.0",
    "source-map-loader": "^0.2.4",
    "spectron": "^5.0.0",
    "style-loader": "^0.23.1",
    "ts-jest": "^24.0.2",
    "ts-loader": "^7.0.4",
    "typescript": "^3.8.3",
    "webpack": "^4.43.0",
    "webpack-cli": "^3.3.2",
    "webpack-dev-server": "^3.4.1",
    "webpack-merge": "^4.2.1"
  },
  "dependencies": {
    "@material-ui/core": "^4.9.14",
    "@material-ui/icons": "^4.9.1",
    "fs-extra": "^9.0.0",
    "live-plugin-manager": "^0.14.1",
    "node-polyglot": "^2.4.0",
    "react": "^16.8.6",
    "react-dom": "^16.8.6"
  }

from live-plugin-manager.

Randgalt avatar Randgalt commented on May 26, 2024

FYI - I used a builder to get to the electron app. I'll likely abandon this build and start from scratch.

from live-plugin-manager.

davideicardi avatar davideicardi commented on May 26, 2024

I have found the incompatible libraries, they are @types/jest and @types/webpack-env.
If you remove these two libraries it works fine. I think that the problem is that they "override" the require function adding additional properties.
Not sure how can I solve this on my side, I will think about it... in the meantime maybe you can remove it? Do you need types for these libraries?

from live-plugin-manager.

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.