Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Venkat,

Please use npm run localhost --demo1

Then go to the url

Thanks


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(