-
Describe the bug
Reproductionhttps://github.com/Veiintc/vite-cjs-csslose.git System InfoSystem:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 2.98 GB / 15.83 GB
Binaries:
Node: 14.6.0 - D:\Program Files\nodejs\node.EXE
npm: 6.14.6 - D:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1023.0), Chromium (91.0.864.64)
Internet Explorer: 11.0.19041.1 Used Package Managernpm Logsvite:config bundled config file loaded in 153ms +0ms
vite:config using resolved config: {
vite:config build: {
vite:config target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
vite:config polyfillDynamicImport: false,
vite:config outDir: 'dist',
vite:config assetsDir: 'assets',
vite:config assetsInlineLimit: 4096,
vite:config cssCodeSplit: true,
vite:config sourcemap: false,
vite:config rollupOptions: { output: [Object] },
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
vite:config minify: false,
vite:config terserOptions: {},
vite:config cleanCssOptions: {},
vite:config write: true,
vite:config emptyOutDir: null,
vite:config manifest: false,
vite:config lib: false,
vite:config ssr: false,
vite:config ssrManifest: false,
vite:config brotliSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null
vite:config },
vite:config plugins: [
vite:config 'alias',
vite:config 'vite:dynamic-import-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite:vue',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:build-html',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'rollup-plugin-dynamic-import-variables',
vite:config 'asset-import-meta-url',
vite:config 'vite:import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:reporter'
vite:config ],
vite:config define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
vite:config ssr: { external: [ 'vue', '@vue/server-renderer' ] },
vite:config configFile: 'D:/Program Files/test/vite-preload-dep/vite.config.js',
vite:config configFileDependencies: [ 'vite.config.js' ],
vite:config inlineConfig: {
vite:config root: undefined,
vite:config base: undefined,
vite:config mode: undefined,
vite:config configFile: undefined,
vite:config logLevel: undefined,
vite:config clearScreen: undefined,
vite:config build: {}
vite:config },
vite:config root: 'D:/Program Files/test/vite-preload-dep',
vite:config base: '/',
vite:config resolve: { dedupe: undefined, alias: [ [Object] ] },
vite:config publicDir: 'D:\\Program Files\\test\\vite-preload-dep\\public',
vite:config cacheDir: 'D:\\Program Files\\test\\vite-preload-dep\\node_modules\\.vite',
vite:config command: 'build',
vite:config mode: 'production',
vite:config isProduction: true,
vite:config server: { fs: { strict: undefined, allow: [Array] } },
vite:config env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
vite:config assetsInclude: [Function: assetsInclude],
vite:config logger: {
vite:config hasWarned: false,
vite:config info: [Function: info],
vite:config warn: [Function: warn],
vite:config warnOnce: [Function: warnOnce],
vite:config error: [Function: error],
vite:config clearScreen: [Function: clearScreen]
vite:config },
vite:config createResolver: [Function: createResolver],
vite:config optimizeDeps: { esbuildOptions: { keepNames: undefined } }
vite:config } +8ms Validations
|
Beta Was this translation helpful? Give feedback.
Replies: 14 comments
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
-
@Veiintc Do you ask for a |
Beta Was this translation helpful? Give feedback.
-
Is this a low priority issue? |
Beta Was this translation helpful? Give feedback.
-
I'm not sure right now. I'm not as deep into it and know what is happening here, so I cannot assign a label like p3 or p4 or p5. |
Beta Was this translation helpful? Give feedback.
-
Hi, @Veiintc can you explain an expected behaviour, please? Do you expect "CJS" CommonJS module to be in your build or what? And why you marked the CSS file on your screenshot? Thanks a lot |
Beta Was this translation helpful? Give feedback.
-
it seems my description is not accurate enough, |
Beta Was this translation helpful? Give feedback.
-
@Veiintc gotta. I think I get you. I opened your reproduction repo. As I understand you can't find styles from your If I get you right and it is. So, you don't include your CSS module file in your project and the needed styles will NOT be in your prod build. Now they are unused and they don't have to be in your build. They are not in the module graph. I added this script line in your component <template>
<h2>Scan Deps from <script setup lang=ts> blocks</h2>
<div class="scan">{{ typeof debounce === 'function' ? 'ok' : 'error' }}</div>
</template>
<script>
import classes from './common.module.less'
</script>
<style lang="less" scoped>
.scan{
color: blue;
}
</style> And now I can see the needed styles in my final production build by executing the command ._root_xlv1v_1 {
color: red;
}
.scan[data-v-4e39fff2] {
color: blue;
} |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply, |
Beta Was this translation helpful? Give feedback.
-
are you format cjs? |
Beta Was this translation helpful? Give feedback.
-
Man, I just run your project, that you provided. Where is the file in CJS format? I don't understand |
Beta Was this translation helpful? Give feedback.
-
are you run dev ? |
Beta Was this translation helpful? Give feedback.
are you run dev ?
build outfile format cjs,it not run in browser。