Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(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) #2805

Open
ajiho opened this issue May 14, 2024 · 0 comments

Comments

@ajiho
Copy link

ajiho commented May 14, 2024

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant