himanushi / music-client-v3

music-server のAPIを使用し曲検索と音楽が再生出来るプラットフォーム(svelte バージョン)
https://video-game-music.net
7 stars 0 forks source link

Failed to load ../runtime/Router.svelte #5

Closed himanushi closed 3 years ago

himanushi commented 3 years ago

Error with @snowpack 3.5.1 & @roxi/routify 2.18.0. snowpack 3.0.13 has no errors.

snowpack dev --verbose

[02:39:37] [snowpack] run command: dev
[02:39:42] [snowpack] loaded plugin: /app/node_modules/@snowpack/plugin-svelte/plugin.js
[02:39:43] [snowpack] loaded plugin: /app/node_modules/@snowpack/plugin-dotenv/plugin.js
[02:39:43] [snowpack] loaded plugin: /app/node_modules/@snowpack/plugin-typescript/plugin.js
[02:39:43] [snowpack] config loaded: {
  root: '/app',
  plugins: [
    {
      name: '@snowpack/plugin-svelte',
      resolve: [Object],
      knownEntrypoints: [Array],
      load: [AsyncFunction: load],
      markChanged: [Function (anonymous)]
    },
    {
      name: '@snowpack/plugin-dotenv',
      markChanged: [Function (anonymous)]
    },
    {
      name: '@snowpack/plugin-typescript',
      run: [AsyncFunction: run],
      markChanged: [Function (anonymous)]
    },
    {
      name: '@snowpack/plugin-esbuild',
      resolve: [Object],
      load: [AsyncFunction: load],
      cleanup: [Function: cleanup]
    }
  ],
  alias: { routify: '/app/.routify', '~': '/app/src' },
  env: {},
  exclude: [
    '**/_*.{sass,scss}',
    '**.d.ts',
    '/app/build/**',
    '**/node_modules/**'
  ],
  routes: [
    {
      src: '^.*$',
      dest: '/index.html',
      upgrade: undefined,
      match: 'routes',
      _srcRegex: /^.*$/
    }
  ],
  dependencies: {},
  devOptions: {
    secure: false,
    hostname: 'localhost',
    port: 8080,
    hmrDelay: 0,
    hmrPort: undefined,
    hmrErrorOverlay: true
  },
  buildOptions: {
    out: '/app/build',
    baseUrl: '/',
    metaUrlPath: '/_snowpack',
    cacheDirPath: '/app/node_modules/.cache/snowpack',
    clean: true,
    sourcemap: false,
    watch: false,
    htmlFragments: false,
    ssr: false,
    resolveProxyImports: true
  },
  testOptions: { files: [ '__tests__/**/*', '**/*.@(spec|test).*' ] },
  packageOptions: {
    source: 'local',
    external: [],
    packageLookupFields: [ 'svelte' ],
    knownEntrypoints: [
      'svelte/internal',
      'svelte-hmr/runtime/hot-api-esm.js',
      'svelte-hmr/runtime/proxy-adapter-dom.js'
    ],
    rollup: { plugins: [Array] }
  },
  mount: {
    '/app/.routify': { url: '/', static: false, resolve: true },
    '/app/public': { url: '/', static: true, resolve: true },
    '/app/src': { url: '/', static: false, resolve: true }
  },
  optimize: {
    entrypoints: 'auto',
    preload: false,
    bundle: true,
    sourcemap: true,
    splitting: false,
    treeshake: true,
    manifest: false,
    target: 'es2020',
    minify: true
  },
  experiments: {},
  mode: 'development',
  _extensionMap: {
    '.svelte': [ '.js', '.css' ],
    '.mjs': [ '.js' ],
    '.jsx': [ '.js' ],
    '.ts': [ '.js' ],
    '.tsx': [ '.js' ]
  }
}
[02:39:43] [snowpack] lockfile not loaded
[02:39:43] [snowpack] Welcome to Snowpack! Because this is your first time running
this project, Snowpack needs to prepare your dependencies. This is a one-time step
and the results will be cached for the lifetime of your project. Please wait...
----------
[02:39:45] [snowpack] + @roxi/routify@2.18.0
[02:39:45] [esinstall:@roxi/routify] /app
[02:39:45] [esinstall:@roxi/routify] running installer with options: {"input":{"@roxi/routify":"/app/node_modules/@roxi/routify/runtime/index.js"},"treeshake":{"moduleSideEffects":true},"plugins":[{"name":"alias"},{"name":"snowpack:fetch-handler"},{"name":"node-resolve"},{"name":"json"},{"name":"snowpack:rollup-plugin-css"},{"name":"replace"},{"name":"commonjs"},{"name":"snowpack:wrap-install-targets"},{"name":"snowpack:rollup-plugin-node-process-polyfill"},{"name":"svelte"},{"name":"esinstall:snowpack"},{"name":"snowpack:rollup-plugin-catch-unresolved"},{"name":"snowpack:rollup-plugin-strip-source-mapping"}]}
[02:39:45] [esinstall:@roxi/routify] cjsAutoDetectExportsStatic /app/node_modules/@roxi/routify/runtime/index.js: Unexpected export statement in CJS module.
  at @:1:8
[02:39:45] [esinstall:@roxi/routify] cjsAutoDetectExportsRuntime error /app/node_modules/@roxi/routify/runtime/index.js: Command failed with exit code 1: node -p JSON.stringify(Object.keys(require('/app/node_modules/@roxi/routify/runtime/index.js')))
/app/node_modules/@roxi/routify/runtime/index.js:1
export { default as Router } from './Router.svelte'
^^^^^^

SyntaxError: Unexpected token 'export'
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at [eval]:1:28
    at Script.runInThisContext (vm.js:133:18)
    at Object.runInThisContext (vm.js:310:38)
[02:39:45] [esinstall:@roxi/routify] cjsAutoDetectExportsRuntimeUntrusted error /app/node_modules/@roxi/routify/runtime/index.js: Unexpected token 'export'
[02:39:45] [@snowpack/plugin-svelte] load() starting… [node_modules/@roxi/routify/runtime/Router.svelte]
[02:39:45] [@snowpack/plugin-svelte] load() starting… [node_modules/@roxi/routify/runtime/Route.svelte]
[02:39:46] [@snowpack/plugin-svelte] ✔ load() success [node_modules/@roxi/routify/runtime/Router.svelte]
[02:39:46] [esinstall:@roxi/routify] FAILURE: Expected } (12:6)
10:   globals,
11:   group_outros,
12:   init as init_1,
           ^
13:   insert_dev,
14:   mount_component,
[02:39:46] [esinstall:@roxi/routify] Failed to load ../runtime/Router.svelte
  Try installing rollup-plugin-svelte and adding it to Snowpack (https://www.snowpack.dev/tutorials/svelte)
[02:39:46] [snowpack] Install failed.
[02:39:46] [snowpack] Error: Install failed.
    at Object.install (/app/node_modules/snowpack/lib/index.js:94751:19)
    at async Object.installPackages (/app/node_modules/snowpack/lib/index.js:122735:25)
    at async /app/node_modules/snowpack/lib/index.js:123307:39
    at async PackageSourceLocal.buildPackageImport (/app/node_modules/snowpack/lib/index.js:123219:30)
    at async PackageSourceLocal.prepare (/app/node_modules/snowpack/lib/index.js:122999:13)
    at async startServer (/app/node_modules/snowpack/lib/index.js:182376:9)
    at async Object.command (/app/node_modules/snowpack/lib/index.js:183024:9)
    at async cli (/app/node_modules/snowpack/lib/index.js:183689:9)
himanushi commented 3 years ago

Update snowpack 3.0.13 because tailwindcss jit does not load string class name dynamically. https://github.com/snowpackjs/snowpack/issues/3246

himanushi commented 3 years ago

No problem with snowpack 3.3.5, but errors occur with snowpack 3.3.6.

himanushi commented 3 years ago

There was a problem with the installation order of snowpack. I added the following to solve the problem. https://github.com/himanushi/music-client-v3/blob/5cd7d3c4f3f45846cb4d104f69cdfa9155f7b199/snowpack.config.js#L20