Skip to content

Commit 8514df3

Browse files
committed
add webpack bundling
1 parent cb92997 commit 8514df3

File tree

7 files changed

+2051
-24
lines changed

7 files changed

+2051
-24
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
out
33
*.vsix
4-
vsc-extension-quickstart.md
4+
vsc-extension-quickstart.md
5+
dist

.vscodeignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
.vscode/**
22
.vscode-test/**
3-
out/test/**
4-
src/**
53
.gitignore
64
vsc-extension-quickstart.md
75
**/tsconfig.json
86
**/.eslintrc.json
97
**/*.map
108
**/*.ts
9+
out/
10+
src/
11+
tsconfig.json
12+
webpack.config.js
1113
node_modules
1214
example/*

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,7 @@ This extension is currently in development, so any issues or feedback would be a
6868
### 1.0.3
6969

7070
- Add new Marketplace categories and tags
71+
72+
### 1.0.4
73+
74+
- Use Webpack to bundle extension

example/.DS_Store

6 KB
Binary file not shown.

package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "css-inline-converter",
44
"description": "Converts CSS from inline JSX/TSX to regular CSS notation",
55
"icon": "images/icon.png",
6-
"version": "1.0.3",
6+
"version": "1.0.4",
77
"engines": {
88
"vscode": "^1.43.0"
99
},
@@ -25,7 +25,7 @@
2525
"activationEvents": [
2626
"onCommand:extension.cssinline"
2727
],
28-
"main": "./out/extension.js",
28+
"main": "./dist/extension.js",
2929
"contributes": {
3030
"commands": [
3131
{
@@ -36,12 +36,15 @@
3636
},
3737
"publisher": "johnmurphy01",
3838
"scripts": {
39-
"vscode:prepublish": "yarn run compile",
4039
"compile": "tsc -p ./",
4140
"lint": "eslint src --ext ts",
4241
"watch": "tsc -watch -p ./",
4342
"pretest": "yarn run compile && yarn run lint",
44-
"test": "node ./out/test/runTest.js"
43+
"test": "node ./out/test/runTest.js",
44+
"vscode:prepublish": "webpack --mode production",
45+
"webpack": "webpack --mode development",
46+
"webpack-dev": "webpack --mode development --watch",
47+
"test-compile": "tsc -p ./"
4548
},
4649
"devDependencies": {
4750
"@types/glob": "^7.1.1",
@@ -53,8 +56,11 @@
5356
"eslint": "^6.8.0",
5457
"glob": "^7.1.6",
5558
"mocha": "^7.0.1",
59+
"ts-loader": "^6.2.2",
5660
"typescript": "^3.7.5",
57-
"vscode-test": "^1.3.0"
61+
"vscode-test": "^1.3.0",
62+
"webpack": "^4.42.0",
63+
"webpack-cli": "^3.3.11"
5864
},
5965
"dependencies": {
6066
"@types/lodash": "^4.14.149",

webpack.config.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//@ts-check
2+
3+
"use strict";
4+
5+
const path = require("path");
6+
7+
/**@type {import('webpack').Configuration}*/
8+
const config = {
9+
target: "node", // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
10+
11+
entry: "./src/extension.ts", // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
12+
output: {
13+
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
14+
path: path.resolve(__dirname, "dist"),
15+
filename: "extension.js",
16+
libraryTarget: "commonjs2",
17+
devtoolModuleFilenameTemplate: "../[resource-path]"
18+
},
19+
devtool: "source-map",
20+
externals: {
21+
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/
22+
},
23+
resolve: {
24+
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
25+
extensions: [".ts", ".js"]
26+
},
27+
module: {
28+
rules: [
29+
{
30+
test: /\.ts$/,
31+
exclude: /node_modules/,
32+
use: [
33+
{
34+
loader: "ts-loader"
35+
}
36+
]
37+
}
38+
]
39+
}
40+
};
41+
module.exports = config;

0 commit comments

Comments
 (0)