AlexzanderFlores / WOKCommands

132 stars 61 forks source link

Cannot use import statement outside a module #221

Open d36u9-dev opened 2 years ago

d36u9-dev commented 2 years ago

When I clone the repository and run npm run dev I get the following error.:

\WOKCommands\index.js:1
import WOKCommands from './src'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1027:15)
    at Module._compile (node:internal/modules/cjs/loader:1063:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

If I set "type": "module" in the package.json or use the .mjs extension it doesn't change the problem either. Now if I just compile everything like this and host it locally as a packet the handler doesn't work either. So if I remove or overwrite the existing dist folder with the current unchanged code then it doesn't work at all. This must mean that the base code is different from the existing dist folder?

tippfehlr commented 2 years ago

What do you want to achive by running wokcommands itself?