{"action":"opened","issue":{"url":"https://api.github.com/repos/typeorm/typeorm/issues/3152","repository_url":"https://api.github.com/repos/typeorm/typeorm","labels_url":"https://api.github.com/repos/typeorm/typeorm/issues/3152/labels{/name}","comments_url":"https://api.github.com/repos/typeorm/typeorm/issues/3152/comments","events_url":"https://api.github.com/repos/typeorm/typeorm/issues/3152/events","html_url":"https://github.com/typeorm/typeorm/issues/3152","id":383908192,"node_id":"MDU6SXNzdWUzODM5MDgxOTI=","number":3152,"title":"Webpack support is limited.","user":{"login":"itonics-tbeauvais","id":9199882,"node_id":"MDQ6VXNlcjkxOTk4ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/9199882?v=4","gravatar_id":"","url":"https://api.github.com/users/itonics-tbeauvais","html_url":"https://github.com/itonics-tbeauvais","followers_url":"https://api.github.com/users/itonics-tbeauvais/followers","following_url":"https://api.github.com/users/itonics-tbeauvais/following{/other_user}","gists_url":"https://api.github.com/users/itonics-tbeauvais/gists{/gist_id}","starred_url":"https://api.github.com/users/itonics-tbeauvais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itonics-tbeauvais/subscriptions","organizations_url":"https://api.github.com/users/itonics-tbeauvais/orgs","repos_url":"https://api.github.com/users/itonics-tbeauvais/repos","events_url":"https://api.github.com/users/itonics-tbeauvais/events{/privacy}","received_events_url":"https://api.github.com/users/itonics-tbeauvais/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-23T18:52:09Z","updated_at":"2018-11-23T18:52:09Z","closed_at":null,"author_association":"NONE","body":"**Issue type:**\r\n\r\n[ ] question\r\n[x] bug report\r\n[ ] feature request\r\n[ ] documentation issue\r\n\r\n**Database system/driver:**\r\n\r\n[ ] `cordova`\r\n[ ] `mongodb`\r\n[ ] `mssql`\r\n[ ] `mysql` / `mariadb`\r\n[ ] `oracle`\r\n[x] `postgres`\r\n[ ] `sqlite`\r\n[ ] `sqljs`\r\n[ ] `react-native`\r\n[ ] `expo`\r\n\r\n**TypeORM version:**\r\n\r\n[ ] `latest`\r\n[ ] `@next`\r\n[x] `0.2.9` (or put your version here)\r\n\r\n**Steps to reproduce or a small repository showing the problem:**\r\n\r\nAll I did here was us the `typeorm init` to create create a new project that works well. Adding a simple webpack is where problems arise.\r\n\r\nThe problem seems to be with webpack. I have seen a few of these as I have been sifting through your closed and open issues.\r\n\r\nUsing a pretty basic {{webpack.config.js}}\r\n```\r\nconst path = require('path');\r\n\r\nmodule.exports = {\r\n    entry: './src/index.ts',\r\n    mode: 'development',\r\n    module: {\r\n        rules: [\r\n            {\r\n                test: /\\.tsx?$/,\r\n                use: 'ts-loader',\r\n                exclude: /node_modules/\r\n            }\r\n        ]\r\n    },\r\n    resolve: {\r\n        extensions: ['.tsx', '.ts', '.js','.json']\r\n    },\r\n    // added as a result of the available node libraries\r\n    externals: {\r\n        fs: '{}',\r\n        tls: '{}',\r\n        net: '{}',\r\n        dns: '{}',\r\n        readline: '{}'\r\n    },\r\n    output: {\r\n        filename: 'bundle.js',\r\n        path: path.resolve(__dirname, 'dist')\r\n    }\r\n};\r\n```\r\n\r\nRunning this..\r\n```\r\nnode dist/bundle.js\r\n```\r\n\r\nResults in the following runing error.\r\n```\r\n{ Error: Cannot find module '/node_modules/app-root-path'\r\n    at webpackEmptyContext (webpack:///./node_modules/typeorm/platform_sync?:2:10)\r\n    at Function.PlatformTools.load (webpack:///./node_modules/typeorm/platform/PlatformTools.js?:136:93)\r\n    at ConnectionOptionsReader.get [as baseDirectory] (webpack:///./node_modules/typeorm/connection/ConnectionOptionsReader.js?:247:50)\r\n    at ConnectionOptionsReader.get [as baseFilePath] (webpack:///./node_modules/typeorm/connection/ConnectionOptionsReader.js?:235:25)\r\n    at ConnectionOptionsReader.eval (webpack:///./node_modules/typeorm/connection/ConnectionOptionsReader.js?:130:50)\r\n    at step (webpack:///./node_modules/typeorm/connection/ConnectionOptionsReader.js?:32:23)\r\n    at Object.eval [as next] (webpack:///./node_modules/typeorm/connection/ConnectionOptionsReader.js?:13:53)\r\n    at eval (webpack:///./node_modules/typeorm/connection/ConnectionOptionsReader.js?:7:71)\r\n    at new Promise (<anonymous>)\r\n    at __awaiter (webpack:///./node_modules/typeorm/connection/ConnectionOptionsReader.js?:3:12) code: 'MODULE_NOT_FOUND' }\r\n```\r\n\r\nIt seems that the problem stems from this PlatformTools library that dynamic attempts to load libraries. For me, even manually installing `app-root-path` and adding `require('app-root-path')` in my application doesn't help.\r\n\r\nNow, I know that webpack is just a pain to support. It seems the dynamic nature of the `PlatformTools` loading dependencies doesn't mesh well. Any insight or examples would be nice."}}
{"actor":{"display_login":"itonics-tbeauvais"}}