1
が定義されていない私はGulpロールアップ:(定義|必要|モジュール)
で次をRollupを使用しようとしている私のGulpfileです:
const gulp = require("gulp");
const rollup = require("rollup-stream");
const vue = require("rollup-plugin-vue");
const resolve = require("rollup-plugin-node-resolve");
const commonjs = require("rollup-plugin-commonjs");
const json = require("rollup-plugin-json");
const babel = require("rollup-plugin-babel");
const globals = require("rollup-plugin-node-globals");
const source = require("vinyl-source-stream");
const buffer = require("vinyl-buffer");
const uglify = require("gulp-uglify");
// ... CSS tasks and the like
gulp.task("js", function scriptTask()
{
rollup({
input: "js/app.js",
plugins: [
vue(),
resolve({
jsnext: true,
browser: true
}),
json(),
commonjs(),
babel({
exclude: ["node_modules/**"],
presets: [["env", {modules: false}]],
plugins: ["external-helpers"]
}),
globals()
],
format: "iife",
})
.pipe(source("bundle.js"))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest("../dist"));
});
// ... default tasks and the like
これが正常にすべての依存関係や行いを引っ張っているようですツリーを揺するが、出力ファイルは実行されません。しようとしたときのロールアップに渡された「形式」オプションの値に応じて、私は次のいずれかのエラーを取得:
Uncaught ReferenceError: require is not defined
at bundle.js:1
at bundle.js:1
at bundle.js:1
Uncaught ReferenceError: define is not defined
at bundle.js:1
at bundle.js:1
at bundle.js:1
Uncaught ReferenceError: module is not defined
at bundle.js:1
at bundle.js:1
at bundle.js:1
何も動作します!
私は、私はまだあなたの他の2つのエラーを解決しようとする私の答え –
イムであなたの必要モジュールの外観を解決だと思う –