加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 2.98 KB
一键复制 编辑 原始数据 按行查看 历史
const webpack = require('webpack');
const path = require('path');
module.exports = function (env, argv) {
env = env || {};
return [{
name: 'assets',
mode: 'none',
entry: {
overview: './src/overview/assets/index.ts',
'java-runtime': './src/java-runtime/assets/index.ts',
'beginner-tips': './src/beginner-tips/assets/index.tsx',
'ext-guide': './src/ext-guide/assets/index.ts',
welcome: './src/welcome/assets/index.ts',
classpath: './src/classpath/assets/index.tsx',
'formatter-settings': './src/formatter-settings/assets/index.tsx',
'install-jdk': './src/install-jdk/assets/index.tsx'
},
module: {
rules: [{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: 'ts-loader'
}, {
test: /\.(scss)$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}, {
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
[
"autoprefixer",
{
// Options
},
],
],
},
}
}, {
loader: 'sass-loader'
}]
}, {
test: /\.(jpg|png|svg|ico|icns)$/,
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 200000,
},
},
}, {
test: /\.(css)$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}]
}, {
test: /\.(woff2|ttf)$/,
type: 'asset/inline',
}]
},
output: {
filename: 'assets/[name]/index.js',
path: path.resolve(__dirname, 'out'),
publicPath: '/',
devtoolModuleFilenameTemplate: "../[resource-path]"
},
plugins: [
new webpack.ProvidePlugin({
fallback: { 'process/browser': require.resolve('process/browser'), }
}),
],
devtool: 'source-map',
resolve: {
extensions: ['.js', '.ts', '.tsx']
}
}, {
name: 'extension',
target: 'node',
mode: 'none',
entry: {
extension: './src/extension.ts'
},
module: {
rules: [{
test: /\.ts$/,
exclude: /node_modules/,
use: 'ts-loader'
}]
},
resolve: {
modules: ['node_modules', path.resolve(__dirname, 'src')],
mainFiles: ['index'],
extensions: ['.js', '.ts', '.json'],
preferRelative: true
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'out'),
libraryTarget: "commonjs2",
publicPath: '/',
devtoolModuleFilenameTemplate: "../[resource-path]"
},
externals: {
'applicationinsights-native-metrics': 'commonjs applicationinsights-native-metrics', // ignored because we don't ship native module
'diagnostic-channel-publishers': 'commonjs diagnostic-channel-publishers',
vscode: 'commonjs vscode'
},
devtool: 'source-map'
}]
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化