Answer the question
In order to leave comments, you need to log in
Unexpected template string - What is the error when running Gulp?
On startup it gives the following error:
SyntaxError: Unexpected template string
at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:115:18)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:289:14)
{
"name": "gulp-start",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2"
}
}
import * as nodePath from `path`
const rootFolder = nodePath.basename(nodePath.resolve())
const buildFolder = `./dist`
const srcFolder = `./src`
export const path = {
build: {
files: `${buildFolder}/files/`
},
src: {
files: `${srcFolder}/files/**/*.*`,
},
watch: {},
clean: buildFolder,
buildFolder: buildFolder,
srcFolder: srcFolder,
rootFolder: rootFolder,
ftp: ``,
}
// Основной модуль
import gulp from "gulp"
// Импорт путей
import { path } from "./gulp/config/path.js"
// Передаем значение в глобальную переменную
global.app = {
path: path,
gulp: gulp,
}
// Импорт задач
import { copy } from "./gulp/tasks/copy.js"
// Выполнение сценария по умолчанию
gulp.task(`default`, copy)
export const copy = () => {
return app.gulp.src(app.path.src.files)
.pipe(app.gulp.dest(app.path.build.files))
}
Answer the question
In order to leave comments, you need to log in
import * as nodePath from "path"
Imports do not support template strings.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question