Closed slerches closed 5 years ago
svelte-cli
is old and deprecated. Where did you find instructions saying to use it?
As of Svelte v2.4.0, the CLI was built into the svelte
package itself. The built-in CLI was removed entirely in Svelte v3, because it had some severe limitations, it was making things more complicated with little benefit, and was generally seen as a stopgap solution for people not using a bundler.
I'd recommend using Svelte v3 over Svelte v2 if possible, because Svelte v2 is receiving little to no maintenance attention now that v3 is out. If you must use v2, using a proper bundler is along with its Svelte plugin is recommended. And if that's not something you want to do, you should at least be using the Svelte CLI that's built into the main svelte
package, not the one in the separate svelte-cli
package.
What I intend to achieve is to compile svelte files into separate js files and use in existing app just as anyone can pick up a js script from the cdn repo or any js script and add to their pages. I don't want to create a single bundle file and I cant find instructions that simplifies this in svelte3.
Thanks
I found a way to do it and also using svelte 3. Thanks by the way
I just discovered svelte four days ago and I am trying to compile using svelte-cli. But keep having challenge when I import certain components like svelte/store.js. I have tried several options but still cant get it to work. In all my trials, this is one of the errors I encountered.
_Could not determine name for imported module 'svelte/store.js' – use options.globals (node:22822) UnhandledPromiseRejectionWarning: TypeError: clorox.grey is not a function at error (/usr/local/lib/node_modules/svelte-cli/dist/compile.js:80:20) at compileFile (/usr/local/lib/node_modules/svelte-cli/dist/compile.js:186:3) at compile (/usr/local/lib/node_modules/svelte-cli/dist/compile.js:139:3) at prog.command.option.option.option.option.option.option.option.option.option.option.example.example.example.action (/usr/local/lib/node_modules/svelte-cli/dist/index.js:555:3) at process._tickCallback (internal/process/nexttick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:757:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) (node:22822) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:22822) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
`
The time is {hours}:{minutes}:{seconds}
<Widget {...pkg} />`
The code doesnt do much but just testing.