{"action":"opened","issue":{"url":"https://api.github.com/repos/chrmarti/testissues/issues/13751","repository_url":"https://api.github.com/repos/chrmarti/testissues","labels_url":"https://api.github.com/repos/chrmarti/testissues/issues/13751/labels{/name}","comments_url":"https://api.github.com/repos/chrmarti/testissues/issues/13751/comments","events_url":"https://api.github.com/repos/chrmarti/testissues/issues/13751/events","html_url":"https://github.com/chrmarti/testissues/issues/13751","id":296146944,"number":13751,"title":"Building extension with webpack : Can't resolve 'vscode' ","user":{"login":"vscodebot[bot]","id":28792856,"avatar_url":"https://avatars2.githubusercontent.com/in/2406?v=4","gravatar_id":"","url":"https://api.github.com/users/vscodebot%5Bbot%5D","html_url":"https://github.com/apps/vscodebot","followers_url":"https://api.github.com/users/vscodebot%5Bbot%5D/followers","following_url":"https://api.github.com/users/vscodebot%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/vscodebot%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/vscodebot%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vscodebot%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/vscodebot%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/vscodebot%5Bbot%5D/repos","events_url":"https://api.github.com/users/vscodebot%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/vscodebot%5Bbot%5D/received_events","type":"Bot","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-11T00:23:53Z","updated_at":"2018-02-11T00:23:53Z","closed_at":null,"author_association":"NONE","body":"- VSCode Version: 1.20\r\n- OS Version: Windows 10\r\n\r\nI'm trying to set a webpack config for building an extension. Build is done and typescript are transpiled but 'vscode' can't be resolved.\r\n\r\nWhat have I done wrong ? Any ideas ?\r\n\r\nThanks for help.\r\n\r\nwebpack.config.js\r\n```javascript\r\n'use strict';\r\n\r\nvar path = require('path');\r\nvar webpack = require('webpack');\r\nvar merge = require('webpack-merge');\r\nvar UglifyJsPlugin = require('uglifyjs-webpack-plugin');\r\n\r\nvar TARGET = process.env.NODE_ENV;\r\nvar config;\r\nvar common = {\r\n  cache: true,\r\n  devtool: 'source-map',\r\n  entry: {\r\n    extension: './src/extension.ts',\r\n  },\r\n  output: {\r\n    path: path.resolve(__dirname, './out'),\r\n    filename: '[name].js',\r\n  },\r\n  module: {\r\n    rules: [{\r\n      test: /\\.ts(x?)$/,\r\n      exclude: /node_modules/,\r\n      use: 'ts-loader'\r\n    }, {\r\n      test: /\\.js$/,\r\n      exclude: /node_modules/,\r\n      use: {\r\n        loader: 'babel-loader',\r\n        options: {\r\n          presets: ['es2016']\r\n        }\r\n      }\r\n    }]\r\n  },\r\n  resolve: {\r\n    extensions: ['.ts', '.tsx', '.js']\r\n  },\r\n};\r\n\r\nif (TARGET === 'dev') {\r\n  config = merge(common, {});\r\n}\r\n\r\nif (TARGET === 'prod') {\r\n  config = merge(common, {\r\n    plugins: [\r\n      new UglifyJsPlugin({\r\n        uglifyOptions: {\r\n          output: {\r\n            comments: false,\r\n            beautify: false,\r\n          },\r\n          compress: true,\r\n          warnings: false\r\n        }\r\n      })\r\n    ]\r\n  });\r\n}\r\n\r\nmodule.exports = config;\r\n```\r\n\r\npackage.json\r\n```javascript\r\n{\r\n    \"name\": \"myextension\",\r\n    \"displayName\": \"myextension\",\r\n    \"description\": \"My extension description\",\r\n    \"version\": \"0.0.1\",\r\n    \"publisher\": \"devistar\",\r\n    \"engines\": {\r\n        \"vscode\": \"^1.19.0\"\r\n    },\r\n    \"categories\": [\r\n        \"Other\"\r\n    ],\r\n    \"activationEvents\": [\r\n        \"onCommand:extension.sayHello\"\r\n    ],\r\n    \"main\": \"./out/extension\",\r\n    \"contributes\": {\r\n        \"commands\": [\r\n            {\r\n                \"command\": \"extension.sayHello\",\r\n                \"title\": \"Hello World\"\r\n            }\r\n        ]\r\n    },\r\n    \"scripts\": {\r\n        \"vscode:prepublish\": \"npm run compile\",\r\n        \"compile\": \"tsc -p ./\",\r\n        \"watch\": \"tsc -watch -p ./\",\r\n        \"postinstall\": \"node ./node_modules/vscode/bin/install\",\r\n        \"test\": \"npm run compile && node ./node_modules/vscode/bin/test\",\r\n        \"start\": \"cross-env NODE_ENV=\\\"dev\\\" webpack --config ./webpack.config.js\",\r\n        \"build\": \"cross-env NODE_ENV=\\\"prod\\\" webpack --config ./webpack.config.js\"\r\n    },\r\n    \"devDependencies\": {\r\n        \"!types/mocha\": \"^2.2.42\",\r\n        \"!types/node\": \"^7.0.43\",\r\n        \"awesome-typescript-loader\": \"^3.4.1\",\r\n        \"babel-loader\": \"^7.1.2\",\r\n        \"cross-env\": \"^5.1.3\",\r\n        \"ts-loader\": \"^3.4.0\",\r\n        \"typescript\": \"^2.6.1\",\r\n        \"uglifyjs-webpack-plugin\": \"^1.1.8\",\r\n        \"vscode\": \"^1.1.10\",\r\n        \"webpack\": \"^3.10.0\",\r\n        \"webpack-merge\": \"^4.1.1\",\r\n        \"webpack-notifier\": \"^1.5.1\"\r\n    },\r\n    \"dependencies\": {}\r\n}\r\n\r\n```\r\n\r\n```node\r\nPS D:\\Dev\\myextension> npm run start\r\n\r\n> myextension!0.0.1 start D:\\Dev\\myextension\r\n> cross-env NODE_ENV=\"dev\" webpack --config ./webpack.config.js\r\n\r\nHash: d26276f9b0b46e8b9185\r\nVersion: webpack 3.10.0\r\nTime: 863ms\r\n           Asset     Size  Chunks             Chunk Names\r\n    extension.js  4.06 kB       0  [emitted]  extension\r\nextension.js.map  4.41 kB       0  [emitted]  extension\r\n   [0] ./src/extension.ts 1.4 kB {0} [built]\r\n\r\nERROR in ./src/extension.ts\r\nModule not found: Error: Can't resolve 'vscode' in 'D:\\Dev\\myextension\\src'\r\n ! ./src/extension.ts 5:15-32\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 2\r\nnpm ERR! myextension!0.0.1 start: `cross-env NODE_ENV=\"dev\" webpack --config ./webpack.config.js`\r\nnpm ERR! Exit status 2\r\nnpm ERR!\r\nnpm ERR! Failed at the myextension!0.0.1 start script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\n```\r\n"}}
{"actor":{"display_login":"vscodebot"}}