Skip to content
This repository was archived by the owner on May 28, 2020. It is now read-only.

Commit 20b683a

Browse files
committed
bundling extension using webpack
1 parent 61286ba commit 20b683a

File tree

6 files changed

+2639
-48
lines changed

6 files changed

+2639
-48
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
out
2+
dist
23
node_modules
34
*.vsix

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"request": "launch",
1212
"runtimeExecutable": "${execPath}",
1313
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
14-
"outFiles": ["${workspaceFolder}/out/**/*.js"],
14+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
1515
"preLaunchTask": "npm: watch"
1616
}
1717
]

.vscodeignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ src/**
77
**/*.map
88
*.vsix
99

10+
node_modules
11+
out/
12+
1013
images/**/*.gif
1114
images/**/*.png
1215

@@ -20,6 +23,7 @@ images/**/*.png
2023

2124
tsconfig*.json
2225
package-lock.json
26+
webpack.config.js
2327

2428
CODE_OF_CONDUCT.md
2529
CODING_STANDARDS.md

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-deno",
33
"displayName": "%deno.displayName%",
44
"description": "%deno.description%",
5-
"version": "1.0.4",
5+
"version": "1.0.5",
66
"publisher": "justjavac",
77
"icon": "deno.png",
88
"galleryBanner": {
@@ -41,7 +41,7 @@
4141
"onCommand:deno.enable",
4242
"onCommand:deno.disable"
4343
],
44-
"main": "./out/extension.js",
44+
"main": "./dist/extension",
4545
"contributes": {
4646
"typescriptServerPlugins": [
4747
{
@@ -128,16 +128,20 @@
128128
]
129129
},
130130
"scripts": {
131-
"vscode:prepublish": "yarn compile",
131+
"vscode:prepublish": "webpack --mode production",
132132
"postinstall": "node ./node_modules/vscode/bin/install",
133-
"watch": "tsc -watch -p ./",
134-
"compile": "tsc -p ./"
133+
"compile": "webpack --mode none",
134+
"watch": "webpack --mode none --watch"
135135
},
136136
"devDependencies": {
137137
"@types/node": "^10.12.18",
138+
"@types/webpack": "^4.4.25",
138139
"@types/which": "^1.3.1",
140+
"ts-loader": "^5.3.3",
139141
"typescript": "^3.2.4",
140-
"vscode": "^1.1.27"
142+
"vscode": "^1.1.27",
143+
"webpack": "^4.29.6",
144+
"webpack-cli": "^3.2.3"
141145
},
142146
"dependencies": {
143147
"typescript-deno-plugin": "^1.1.0",

webpack.config.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
//@ts-check
7+
8+
"use strict";
9+
10+
const path = require("path");
11+
12+
/**@type {import('webpack').Configuration}*/
13+
const config = {
14+
target: "node", // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
15+
16+
entry: "./src/extension.ts", // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
17+
output: {
18+
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
19+
path: path.resolve(__dirname, "dist"),
20+
filename: "extension.js",
21+
libraryTarget: "commonjs2",
22+
devtoolModuleFilenameTemplate: "../[resource-path]"
23+
},
24+
devtool: "source-map",
25+
externals: {
26+
vscode: "commonjs vscode" // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
27+
},
28+
resolve: {
29+
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
30+
extensions: [".ts", ".js"]
31+
},
32+
module: {
33+
rules: [
34+
{
35+
test: /\.ts$/,
36+
exclude: /node_modules/,
37+
use: [
38+
{
39+
loader: "ts-loader"
40+
}
41+
]
42+
}
43+
]
44+
}
45+
};
46+
module.exports = config;

0 commit comments

Comments
 (0)