vitepress
                                
                                 vitepress copied to clipboard
                                
                                    vitepress copied to clipboard
                            
                            
                            
                        dev works but build not (Cannot use import statement outside a module)
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! [email protected] 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
v0.19.1 still exist
v0.21.6 still exist
v0.22.2 still exist
Workaround: use dynamic import
see also https://github.com/vuejs/vitepress/issues/476#issuecomment-1028299092
v0.22.4
when i using ant-design-vue.
Cannot use import statement outside a module
import { tuple } from '../_util/type';

@brc-dd
@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.