Files
Viper_VSCode/packages/vscode-pyright/rspack.config.js
TermiNexus e9e4693333
Some checks failed
Run mypy_primer on push / Run mypy_primer on push (push) Has been cancelled
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled
初始化上传
2026-07-24 17:08:39 +08:00

59 lines
1.9 KiB
JavaScript

const path = require('path');
const { createRequire } = require('module');
const { monorepoResourceNameMapper, tsconfigResolveAliases } = require('../../build/lib/webpack');
const rspack = createRequire(__filename)('@rspack/core');
const outPath = path.resolve(__dirname, 'dist');
const typeshedFallback = path.resolve(__dirname, '..', 'pyright-internal', 'typeshed-fallback');
/** @type {(env: any, argv: { mode: 'production' | 'development' | 'none' }) => any} */
module.exports = (_, { mode }) => {
return {
context: __dirname,
entry: {
extension: './src/extension.ts',
server: './src/server.ts',
},
target: 'node',
output: {
filename: '[name].js',
path: outPath,
library: {
type: 'commonjs2',
},
devtoolModuleFilenameTemplate:
mode === 'development' ? '../[resource-path]' : monorepoResourceNameMapper('vscode-pyright'),
clean: true,
},
devtool: mode === 'development' ? 'source-map' : 'nosources-source-map',
cache: mode === 'development',
stats: {
all: false,
errors: true,
warnings: true,
publicPath: true,
timings: true,
},
resolve: {
extensions: ['.ts', '.js'],
alias: tsconfigResolveAliases('tsconfig.json'),
},
externals: {
vscode: 'commonjs vscode',
fsevents: 'commonjs2 fsevents',
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
configFile: path.resolve(__dirname, 'tsconfig.json'),
},
},
],
},
plugins: [new rspack.CopyRspackPlugin({ patterns: [{ from: typeshedFallback, to: 'typeshed-fallback' }] })],
};
};