执行此:
var stringA1 = btoa(stringB);
产生此错误。
我现在正在测试这个,所以application.ts就是这个
node .\node_modules\webpack\bin\webpack.js --config scripts/webpack.config.js --display-error-details
webpack文件如下所示:
export class Aureus {
constructor() {
alert('1');
}
}
我收到此错误?
const globule = require("globule");
const path = require("path");
const webpack = require("webpack");
const extractTextPlugin = require("extract-text-webpack-plugin");
const config = {
};
const configuration = {
context: __dirname,
entry: {
"application":
"application.ts",
...globule.find("aureus/**/*.ts", { srcBase: "./scripts" }),
,
"vendor": [
"bootstrap",
"jquery",
"angular",
"moment",
"lodash",
"ramda",
],
},
output: {
path: path.join(__dirname, "../"),
filename: "packed.js"
},
devtool: "source-map",
plugins: [
new webpack.LoaderOptionsPlugin({
debug: true
}),
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
filename: "vendor.js"
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
"window.jquery": "jquery",
}),
],
resolve:
{
alias: {
}
},
module: {
rules: [
{
test: /^((?!\.spec\.ts).)*.ts$/,
use: [
{
loader: "awesome-typescript-loader"
}
],
exclude: /(node_modules)/
},
]
}
};
module.exports = configuration;
位于application.ts
(与webpack.config.js相同的目录)
./scripts/application.ts
答案 0 :(得分:1)
除非您提供实际的resolve
规则,否则node_modules
中任何内容的导入都将默认查找提供给context
的文件夹。
试试这个:
resolve: {
modules: [
/* assuming that one up is where your node_modules sit,
relative to the currently executing script
*/
path.join(__dirname, '../node_modules')
]
}
此外,请确保您引用entry
相对context
的{{1}},如下所示:
"application": "./application.ts"
而不是
"application": "application.ts"
答案 1 :(得分:0)
也许你需要检查你的 package-lock.json,并假设你的包版本是正确的
当您的软件包版本不正确时,NPM 会出现此错误。
这里有三个提示:
node -v
nom i
像这样:
"eslint": "^5.16.0",
代替:
"eslint": "^4.4.0",