Skip to content

Commit

Permalink
Merge pull request #3 from v8/bundling
Browse files Browse the repository at this point in the history
Use webpack to bundle the extension
  • Loading branch information
szuend authored Jun 17, 2019
2 parents 15b834e + 1ee4f14 commit 3405fd2
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
node_modules/
out/
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"eamodio.tsl-problem-matcher"
]
}
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"isBackground": true,
"problemMatcher": [
"$tsc-watch"
"$ts-webpack"
]
}
]
Expand Down
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.gitignore
.vscode
node_modules/
out/
src/
tsconfig.json
tslint.json
webpack.config.js
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"onLanguage:torque",
"workspaceContains:**/*.tq"
],
"main": "out/extension.js",
"main": "dist/extension.js",
"contributes": {
"configuration": {
"type": "object",
Expand Down Expand Up @@ -82,15 +82,18 @@
},
"devDependencies": {
"@types/node": "^8.0.0",
"vscode": "^1.1.21",
"ts-loader": "^6.0.2",
"tslint": "^5.11.0",
"typescript": "^3.1.3"
"typescript": "^3.1.3",
"vscode": "^1.1.21",
"webpack": "^4.34.0",
"webpack-cli": "^3.3.4"
},
"scripts": {
"update-vscode": "vscode-install",
"postinstall": "vscode-install",
"vscode:prepublish": "npm run update-vscode && npm run compile",
"compile": "tsc -b",
"watch": "tsc -b -w"
"vscode:prepublish": "npm run update-vscode && webpack --mode production",
"compile": "webpack --mode none",
"watch": "webpack --mode none --watch"
}
}
56 changes: 56 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2019 The VSCode V8 Torque Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//@ts-check

'use strict';

const path = require('path');

/**@type {import('webpack').Configuration}*/
const config = {
target: 'node',
entry: './src/extension.ts',
output: {
// the bundle is stored in the 'dist' folder (check package.json).
path: path.resolve(__dirname, 'dist'),
filename: 'extension.js',
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../[resource-path]'
},
devtool: 'source-map',
externals: {
// the vscode-module is created on-the-fly and must be excluded.
// Add other modules that cannot be webpack'ed.
vscode: 'commonjs vscode'
},
resolve: {
// support reading TypeScript and JavaScript files.
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
}
};
module.exports = config;

0 comments on commit 3405fd2

Please sign in to comment.