gulpjs / gulp

A toolkit to automate & enhance your workflow

Home Page:https://gulpjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(node:7504) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created)

ajiho opened this issue · comments

I have a script banner.mjs

import pkg from '../package.json' assert {type: "json"};
const year = new Date().getFullYear();

function getBanner() {
  return `/*!
 * ${pkg.name} v${pkg.version} (${pkg.homepage})
 * Copyright 2023-${year} ${pkg.author}
 * license ${pkg.license}
 */\n`;
}

export default getBanner

I have defined a task test.mjs

import getBanner from "../banner.mjs";


const test = (cb) => {

  console.log(getBanner())

  cb();
}

export default test;

gulpfile.mjs

import test from './build/tasks/test.mjs'

export {
  test
}

When I execute the gulp test '

There will be warning messages in the console

(node:1892) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

I want to know how to disable this information and still call the task through the simple method of 'gulp test'