Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev works but build not (Cannot use import statement outside a module) #324

Closed
MelihAltintas opened this issue Jun 23, 2021 · 8 comments · Fixed by #856
Closed

dev works but build not (Cannot use import statement outside a module) #324

MelihAltintas opened this issue Jun 23, 2021 · 8 comments · Fixed by #856
Labels
bug Something isn't working
Milestone

Comments

@MelihAltintas
Copy link

MelihAltintas commented Jun 23, 2021

Describe the bug
vitepress dev docs working but vitepress build docs has errors.

> vitepress dev docs

vitepress v0.15.3
vite v2.3.7
D:\vue3-openlayers\docs\.vitepress\config.js

  vite v2.3.7 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose
[@vue/compiler-sfc] <script setup> is still an experimental proposal.
Follow its status at https://github.com/vuejs/rfcs/pull/227.

[@vue/compiler-sfc] When using experimental features,
it is recommended to pin your vue dependencies to exact versions to avoid breakage.
> vitepress build docs

vitepress v0.15.3
vite v2.3.7
⠧ building client + server bundles...
(!) Some chunks are larger than 500kb after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ building client + server bundles...
✖ rendering pages...
build error:
 D:\vue3-openlayers\node_modules\ol\Map.js:17
import CompositeMapRenderer from './renderer/Composite.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:791:14)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Module.<anonymous> (D:\vue3-openlayers\node_modules\vitepress\dist\client\app\temp\app.js:25:13)
    at Module._compile (internal/modules/cjs/loader.js:1085:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue3-openlayers@0.1.0 docs:build: `vitepress build docs`
npm ERR! Exit status 1

Expected behavior

success build

System Info

  • vitepress version: ^0.15.3
  • vite version: 2.3.7
  • Node version: v14.13.0
  • OS version: win 10
@MelihAltintas MelihAltintas added the bug: pending triage Maybe a bug, waiting for confirmation label Jun 23, 2021
@bowencool
Copy link

v0.19.1 still exist

@qc-z
Copy link

qc-z commented Jan 19, 2022

v0.21.6 still exist

@yeojongki
Copy link

yeojongki commented Feb 17, 2022

v0.22.2 still exist

@Enter-tainer
Copy link

Workaround: use dynamic import

see also #476 (comment)

@kiaking kiaking added bug Something isn't working and removed bug: pending triage Maybe a bug, waiting for confirmation labels May 23, 2022
@kiaking kiaking added this to the v1.0.0 milestone May 27, 2022
@cumt-robin
Copy link

v0.22.4

when i using ant-design-vue.

Cannot use import statement outside a module

import { tuple } from '../_util/type';

@Topthinking
Copy link

image

@Topthinking
Copy link

@brc-dd

@brc-dd
Copy link
Member

brc-dd commented Jul 18, 2022

@Topthinking #856 should fix these issues. It's not yet supported in the latest release. Please wait for some time. You can use dynamic imports for now.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants