新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
/*
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
Author Tobias Koppers @sokra
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const CommonJsChunkFormatPlugin = require("../javascript/CommonJsChunkFormatPlugin");
|
|
const EnableChunkLoadingPlugin = require("../javascript/EnableChunkLoadingPlugin");
|
|
|
|
/** @typedef {import("../Compiler")} Compiler */
|
|
|
|
/**
|
|
* @typedef {object} NodeTemplatePluginOptions
|
|
* @property {boolean=} asyncChunkLoading enable async chunk loading
|
|
*/
|
|
|
|
class NodeTemplatePlugin {
|
|
/**
|
|
* @param {NodeTemplatePluginOptions=} options options object
|
|
*/
|
|
constructor(options = {}) {
|
|
/** @type {NodeTemplatePluginOptions} */
|
|
this._options = options;
|
|
}
|
|
|
|
/**
|
|
* Apply the plugin
|
|
* @param {Compiler} compiler the compiler instance
|
|
* @returns {void}
|
|
*/
|
|
apply(compiler) {
|
|
const chunkLoading = this._options.asyncChunkLoading
|
|
? "async-node"
|
|
: "require";
|
|
compiler.options.output.chunkLoading = chunkLoading;
|
|
new CommonJsChunkFormatPlugin().apply(compiler);
|
|
new EnableChunkLoadingPlugin(chunkLoading).apply(compiler);
|
|
}
|
|
}
|
|
|
|
module.exports = NodeTemplatePlugin;
|