Webpack build - 8.0.38 - Gulp Localhost ( Cannot use import statement outside a module)

Hi Team,

I am trying to setup webpack for my HTML (demo8), when I try to run gulp localhost, it throws SyntaxError: Cannot use import statement outside a module .



tester@DESKTOP-AMFSOCN:~/bb/metronic/base/frontend/tools$ npm run build --demo8

> metronic@8.0.38 build
> webpack

>> Building metronic bundle...
>> Completed metronic bundle in 20.873s!
webpack compiled successfully
tester@DESKTOP-AMFSOCN:~/bb/metronic/base/frontend/tools$ gulp localhost
/home/tester/bb/metronic/base/frontend/tools/gulpfile.js:1
import { cleanTask } from "./gulp/clean.js";
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at requireOrImport (/home/tester/.nvm/versions/node/v14.18.2/lib/node_modules/gulp-cli/lib/shared/require-or-import.js:19:11)
at execute (/home/tester/.nvm/versions/node/v14.18.2/lib/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js:37:3)
at Liftoff.handleArguments (/home/tester/.nvm/versions/node/v14.18.2/lib/node_modules/gulp-cli/index.js:211:24)
tester@DESKTOP-AMFSOCN:~/bb/metronic/base/frontend/tools$

Thanks
Venkat.S

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)

Hi Venkat,

Please use npm run localhost --demo1

Then go to the url http://localhost:8080/dist/

Thanks

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(