我找到了一个带有多个入口点和UMD的webpack 库选项的示例
这是示例中的webpack.config.js:
var path = require("path");
module.exports = {
entry: {
alpha: "./alpha",
beta: "./beta"
},
output: {
path: path.join(__dirname, "js"),
filename: "MyLibrary.[name].js",
library: ["MyLibrary", "[name]"],
libraryTarget: "umd"
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是如何配置filename和library动态.我想要的是:
filename入境alpha要a.jsfilename入境beta要b.jslibrary入境alpha要Alphalibrary入境beta要Beta.所以我想知道我是否可以通过以下方式配置这些选项function:
var path = require("path");
module.exports = {
entry: {
alpha: "./alpha",
beta: "./beta"
},
output: …Run Code Online (Sandbox Code Playgroud) 我想在头随机中使用default_random_engine和uniform_real_distribution生成一些随机双数.
我使用Eclipse for C/C++和MinGW来构建我的项目.
当我在编辑器中键入std :: default_random_engine时,Eclipse会提示我"无法解析类型'std :: default_random_engine'".
我已经配置了我的项目以支持C++ 11功能
然后我写了一个列表初始化向量和一个范围来测试C++ 11的支持,代码工作正常.
vector<int> ivec = {1, 2, 3};
for (int i : ivec)
cout << i << " ";
cout << endl;
Run Code Online (Sandbox Code Playgroud)
"std :: default_random_engine"出了什么问题,我该怎么做才能解决这个问题?
只是来自的示例代码C++ Primer 5th Edition: 17.3.3. Using the Regular Expression Library
主要文件main.cpp:
#include <iostream>
#include "regexcase.h"
using namespace std;
int main() {
using_regex();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
头文件regexcase.h:
#ifndef REGEXCASE_H_
#define REGEXCASE_H_
#include <regex>
#include <string>
void using_regex();
std::string parseCode(std::regex_constants::error_type etype);
#endif /* REGEXCASE_H_ */
Run Code Online (Sandbox Code Playgroud)
源文件regexcase.cpp:
#include "regexcase.h"
#include <iostream>
using namespace std;
void using_regex() {
// look for words that violate a well-known spelling rule of thumb, "i before e, except after c":
// …Run Code Online (Sandbox Code Playgroud)