我升级到Symfony 4.1并切换到Encore后面临一个问题。
Uncaught RangeError: Maximum call stack size exceeded
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
at _typeof (bundle.js?v=1.6565:3454)
我试图搜索问题的来源,并且只有在使用来自compose.js(和包含)的jquery include删除所有内容后,Error才会消失。但当然我需要jquery ......
一旦我从'jquery''或'Encore.autoProvidejQuery()'导入jQuery,就会发生错误
Webpack.config.js:
const Encore = require('@symfony/webpack-encore');
let publicPath = '/build/';
if (Encore.isProduction()) { // yarn run encore production
publicPath = '/****_symfony/build/';
}
Encore
.setOutputPath('public/build/')
.setPublicPath(publicPath)
.setManifestKeyPrefix('build/')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.addEntry('bundle', './assets/compose.js')
.enableStylusLoader()
.enableLessLoader()
.enableSassLoader()
;
const config = Encore.getWebpackConfig();
for (const rule of config.module.rules) {
if (rule.hasOwnProperty('use')) {
for (loader of rule.use) {
if (loader.loader === 'babel-loader') {
delete rule.exclude;
}
}
}
}
module.exports = config;
好吧,如果您遇到同样的问题,可能是因为您忘记从package.json中删除旧包。
Babel,Gulp等可能是问题所在。它现在应该正常工作。