pngwn / svelte-adapter

Use Svelte components with Vue and React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building fail

captainQW opened this issue · comments

⠙ Building for production...Browserslist: caniuse-lite is outdated. Please run next command npm update
⠙ Building for production...

ERROR Failed to compile with 1 errors 下午11:08:07

error in ./src/svelte/App.svelte

Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.

<script>

| import { onMount } from "svelte";
| import { fly } from "svelte/transition";

@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/HelloWorld.vue?vue&type=script&lang=js& 6:0-45 8:21-30
@ ./src/components/HelloWorld.vue?vue&type=script&lang=js&
@ ./src/components/HelloWorld.vue
@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&
@ ./src/App.vue?vue&type=script&lang=js&
@ ./src/App.vue
@ ./src/main.js
@ multi ./src/main.js

ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! default@0.1.0 build: vue-cli-service build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the default@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

commented

You need to add svelte-loader to your webpack config. This library does not handle compilation of svelte files, it is merely a compatibility layer between frameworks.