@@ -43,12 +43,14 @@ const PluginPriorities = require('./plugins/plugin-priorities');
4343const applyOptionsCallback = require ( './utils/apply-options-callback' ) ;
4444const sharedEntryTmpName = require ( './utils/sharedEntryTmpName' ) ;
4545const copyEntryTmpName = require ( './utils/copyEntryTmpName' ) ;
46+ const getVueVersion = require ( './utils/get-vue-version' ) ;
4647const tmp = require ( 'tmp' ) ;
4748const fs = require ( 'fs' ) ;
4849const path = require ( 'path' ) ;
4950const stringEscaper = require ( './utils/string-escaper' ) ;
5051const crypto = require ( 'crypto' ) ;
5152const logger = require ( './logger' ) ;
53+ const chalk = require ( 'chalk' ) ;
5254const os = require ( 'os' ) ;
5355
5456class ConfigGenerator {
@@ -100,6 +102,24 @@ class ConfigGenerator {
100102 alias : { }
101103 } ;
102104
105+ if ( this . webpackConfig . useVueLoader && ( this . webpackConfig . vueOptions . runtimeCompilerBuild === true || this . webpackConfig . vueOptions . runtimeCompilerBuild === null ) ) {
106+ if ( this . webpackConfig . vueOptions . runtimeCompilerBuild === null ) {
107+ logger . recommendation ( 'To create a smaller (and CSP-compliant) build, see https://symfony.com/doc/current/frontend/encore/vuejs.html#runtime-compiler-build' ) ;
108+ }
109+
110+ const vueVersion = getVueVersion ( this . webpackConfig ) ;
111+ switch ( vueVersion ) {
112+ case 2 :
113+ config . resolve . alias [ 'vue$' ] = 'vue/dist/vue.esm.js' ;
114+ break ;
115+ case 3 :
116+ config . resolve . alias [ 'vue$' ] = 'vue/dist/vue.esm-bundler.js' ;
117+ break ;
118+ default :
119+ throw new Error ( `Invalid vue version ${ vueVersion } ` ) ;
120+ }
121+ }
122+
103123 if ( this . webpackConfig . usePreact && this . webpackConfig . preactOptions . preactCompat ) {
104124 config . resolve . alias [ 'react' ] = 'preact-compat' ;
105125 config . resolve . alias [ 'react-dom' ] = 'preact-compat' ;
0 commit comments