Flex Compile ERROR:Unable to resolve resource bundle "AAA" for locale "en_US"

本文介绍了解决编译过程中出现的资源未找到错误的方法。主要提供了两种解决方案:一是提供所需的properties文件;二是编译时暂时去掉locale信息。

  如题,当编译一个项目的时候出现的错误。

这个错误是说明,编译器尝试调用一个名字为"AAA"的资源的时候,没有找到该项资源。这个问题是由于代码中使用了ResourceBundle来引用一个locale属性文件造成的。当你引用一个外来的swc的时候,往往会遇到这个问题。因为swc用到的资源文件没有一并添加到项目里面。

 

方法一:为其提供所要求的properties文件

 

1 在相关文件里面找出 AAA.properties。 如果找不到,可以尝试建立一个空白的同名文件,或者用另外project的properties文件改名, 以求蒙混过关。

 

2 找出现在所使用的locale码,该例子的信息来看即为en_US。你也可以从别的地方看到。如果是local project,可以在project, properties 里面的compiler argument里面找到。如果是remoting project, 那可以在flex-config.xml 里面找到。

 

3 把第一步得到的AAA.properties 文件放到locale文件夹下面以locale码(en_US)为名的目录下。并确保locale文件夹被添加到src里面。如 C:/..../locale/en_US 或者C:/..../locale/{locale} (....代表我机上完整路径)

 

ps:我在flex builder 中添加这个路径的时候,发现我只能在 source path里面添加, 而在libs 里面添加并不起作用。所以我觉得是因为该文件不是swc,所以不能当libs来添加。

 

方法二:编译时,把locale信息暂时去掉

项目右键 properties ->ActionScript Compiler->Additional Compiler arguments: -local [empty]

如果是命令行编译即 -locale ""( -locale [empty])

将上述修改整合到我提供的文件中 const path = require('path'); const fs = require('fs'); const WEB_SITE = 'mobile'; const { ZipUpload } = require("@hyfe/hy-utils").default.fs; const TYPE_ENV = process.env.TYPE_ENV; const envSelect = process.env.envSelect; let destPath = "../../s2b/s2b/mobile/dist_mobile/h5" const buildAnalyzeFlag = process.env.analyze; const prodFlag = TYPE_ENV === 'prod'; // ==================== Webpack 5 兼容性修复 ==================== const webpackSourcesPath = require.resolve('webpack-sources'); const webpackSourcesDir = path.dirname(webpackSourcesPath); // ============================================================ const config = { projectName: 'mini-program-taro', date: '2019-5-22', designWidth: 750, deviceRatio: { 640: 2.34 / 2, 750: 1, 828: 1.81 / 2, }, sourceRoot: 'src', outputRoot: `dist/${process.env.TARO_ENV}`, // ==================== 持久化缓存配置 ==================== cache: { enable: true, type: 'filesystem', buildDependencies: { config: [__filename] } }, // ===================================================== alias: { '@/assets': path.resolve(__dirname, '..', 'src/assets'), '@/tpl-assets': path.resolve(__dirname, '..', 'node_modules/@hyfe/ui-taro/lib/assets/templates'), '@/pages': path.resolve(__dirname, '..', 'src/pages'), '@/service': path.resolve(__dirname, '..', 'src/service'), '@/redux': path.resolve(__dirname, '..', 'src/redux'), '@/utils': path.resolve(__dirname, '..', 'src/utils'), '@/libs': path.resolve(__dirname, '..', 'src/libs'), 'taro-ui$': 'taro-ui/lib/index', api: path.resolve(__dirname, '..', 'src/webapi'), wmkit: path.resolve(__dirname, '..', 'src/wmkit/common'), config: path.resolve(__dirname, '..', 'src/wmkit/config'), immutable: path.resolve(__dirname, '..', 'src/wmkit/common/immutable.min.js'), '@/*': path.resolve(__dirname, '..', 'src/*'), // ==================== Webpack 兼容性别名 ==================== 'webpack/sources': webpackSourcesDir }, terser: { enable: true, config: { warnings: false, compress: { drop_debugger: true, drop_console: false, }, }, }, csso: { enable: true, config: { restructure: true, }, }, sass: { resource: [ path.resolve(__dirname, '..', 'src/pages/common/style/swipe.scss'), path.resolve(__dirname, '..', 'node_modules/taro-ui/dist/style/components/modal.scss'), path.resolve(__dirname, '..', 'node_modules/taro-ui/dist/style/components/switch.scss'), path.resolve(__dirname, '..', 'node_modules/taro-ui/dist/style/components/tab-bar.scss'), path.resolve(__dirname, '..', 'node_modules/taro-ui/dist/style/components/badge.scss'), path.resolve(__dirname, '..', 'node_modules/taro-ui/dist/style/components/noticebar.scss'), ], projectDirectory: path.resolve(__dirname, '..'), data: '$nav-height: 48px;', }, defineConstants: { process: { env: { TYPE_ENV: JSON.stringify(process.env.TYPE_ENV), envSelect: JSON.stringify(process.env.envSelect), TARO_ENV: JSON.stringify(process.env.TARO_ENV), analyze: JSON.stringify(process.env.analyze), } }, }, compiler: { type: 'webpack5', prebundle: { enable: false } }, copy: { patterns: [], options: {}, }, plugins: [ [ "@tarojs/plugin-framework-react", { reactRefresh: true // 确保启用热更新 } ], ["babel-plugin-import", { libraryName: "taro-ui", customName: (name, file) => { const nameSection = name.split('-') if (nameSection.length === 4) { nameSection.pop() } const pathMap = { 'tabs/pane': 'tabs-pane', 'modal-action': 'modal/action', 'modal-content': 'modal/content', 'modal-header': 'modal/header', 'badge': 'badge', 'switch': 'switch', 'tab-bar': "tab-bar", 'progress': 'progress', 'icon': 'icon' } const path = nameSection.slice(1).join('-'); return `taro-ui/lib/components/${pathMap[path] || path}`; }, style: (name) => { if (name.includes('/modal')) { return 'taro-ui/dist/style/components/modal.scss' } const wholePath = name.split('/') const compName = wholePath[wholePath.length - 1] const fix = { 'tabs-pane': 'tabs', 'modal/action': 'modal', 'modal/header': 'modal', 'modal/content': 'modal', 'badge': 'badge', 'switch': 'switch', 'tab-bar': "tab-bar", 'progress': 'progress', 'icon': 'icon' }[compName] return `taro-ui/dist/style/components/${fix || compName}.scss` } }] ], framework: 'react', mini: { enableSourceMap: !prodFlag, miniCssExtractPluginOption: { ignoreOrder: true }, compile: {}, postcss: { pxtransform: { enable: true, config: { selectorBlackList: ['body'] }, }, url: { enable: true, config: { limit: 1024, }, }, cssModules: { enable: false, config: { namingPattern: 'module', generateScopedName: '[name]__[local]___[hash:base64:5]', }, }, }, webpackChain(chain, webpack) { // ==================== Webpack 兼容性修复 ==================== chain.resolve.alias.set('webpack/sources', webpackSourcesDir); chain.optimization.minimize(true); buildAnalyzeFlag && chain.plugin('analyzer') .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []); chain.plugin('ignore').use(webpack.IgnorePlugin, [{ resourceRegExp: /^\.\/locale$/, contextRegExp: /moment$/ }]); chain.merge({ optimization: { splitChunks: { cacheGroups: { // 保留原有缓存组配置... }, }, }, }); }, lessLoaderOption: { paths: [path.resolve(__dirname, 'node_modules'), path.resolve(__dirname, '..', 'src')], }, imageUrlLoaderOption: { esModule: false, }, }, h5: { publicPath: `/${WEB_SITE}/`, staticDirectory: 'static', esnextModules: ['taro-ui', '@hyfe/ui-taro', '@hyfe'], output: { filename: 'js/[name].[hash].js', chunkFilename: 'js/[name].[chunkhash].js', }, miniCssExtractPluginOption: { filename: 'css/[name].[hash].css', chunkFilename: 'css/[name].[chunkhash].css', ignoreOrder: true }, router: { basename: `/${WEB_SITE}/`, mode: 'browser', }, enableSourceMap: !prodFlag, postcss: { autoprefixer: { enable: true, config: {}, }, url: { enable: true, config: { limit: 1024, }, }, cssModules: { enable: false, config: { namingPattern: 'module', generateScopedName: '[name]__[local]___[hash:base64:5]', }, }, }, webpackChain(chain) { // ==================== Webpack 兼容性修复 ==================== chain.resolve.alias.set('webpack/sources', webpackSourcesDir); chain.plugin('htmlWebpackPlugin').tap((args) => { args[0].publicPath = `/${WEB_SITE}/`; return args; }); chain.module.rule('script') .exclude .add(/app\.config\.ts$/) chain.merge({ optimization: { splitChunks: { cacheGroups: { lodash: { name: 'lodash', priority: 1000, test(module) { return /[\\/]node_modules[\\/]lodash/.test(module.resource); }, }, }, }, } }); if (prodFlag) { chain.plugin('after-build-plugin') .use(new ZipUpload({ envCode: envSelect, scriptPath: path.resolve(__dirname, './zip_upload.sh'), src: path.resolve(__dirname, '../dist/h5'), dest: path.resolve(__dirname, destPath) })); } }, commonChunks(commonChunks) { commonChunks.push('lodash'); return commonChunks; }, lessLoaderOption: { paths: [path.resolve(__dirname, 'node_modules'), path.resolve(__dirname, '..', 'src')] }, imageUrlLoaderOption: { esModule: false, }, devServer: { host: '0.0.0.0', port: '8080', open: `/${WEB_SITE}/`, }, }, }; module.exports = function (merge) { return merge({}, config, require('./build')); };
最新发布
07-02
/** Copyright © 2013-2021 DataYes, All Rights Reserved. */ /* eslint-disable */ const path = require('path'); const webpack = require('webpack'); const fs = require('fs'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const ForkTSCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const { TsConfigPathsPlugin } = require('awesome-typescript-loader'); const WebpackBar = require('webpackbar'); const CaseSensitive = require('case-sensitive-paths-webpack-plugin'); const withCI = require('@dyc/adam-apple-ci/with-ci'); const withModernBuildOrNot = require('./with-modern'); const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin'); const compose = (...args) => (result) => args.reduceRight((result, fn) => fn(result), result); const theme = require('./theme'); const withDll = (webpackConfig) => { const glob = require('globby'); const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin'); const manifestJson = path.join(process.cwd(), 'node_modules/vender-dll/manifest.json'); if (!fs.existsSync(manifestJson)) { throw new Error('没有找到 node_modules/vender-dll/manifest.json, 尝试npm run build:dll'); } const manifest = path.resolve(process.cwd(), './node_modules/vender-dll/*.dll.js'); webpackConfig.plugins.push( new webpack.DllReferencePlugin({ context: process.cwd(), manifest: require.resolve(path.join(process.cwd(), 'node_modules/vender-dll/manifest.json')), }) ); glob.sync(manifest).forEach((x, i) => { webpackConfig.plugins.push( new AddAssetHtmlPlugin({ filepath: x, includeSourcemap: false, }) ); }); return webpackConfig; }; const withDllOrNot = process.argv.includes('--no-dll') ? (i) => i : withDll; const withLazyBuild = (webpackConfig) => { const LazyCompilePlugin = require('lazy-compile-webpack-plugin'); webpackConfig.plugins.push(new LazyCompilePlugin()); return webpackConfig; }; const withLazyBuildOrNot = process.argv.includes('-l') ? withLazyBuild : (i) => i; module.exports = compose( withLazyBuildOrNot, withModernBuildOrNot({}), withDllOrNot, withCI )({ mode: 'development', devtool: 'eval-cheap-module-source-map', entry: path.join(process.cwd(), 'js/index'), output: { pathinfo: false, filename: 'static/js/[name].bundle.js', path: path.join(process.cwd(), 'build'), chunkFilename: 'static/js/[name].chunk.js', publicPath: '/', }, resolve: { symlinks: false, modules: ['node_modules', 'js', 'framework/src'], extensions: ['.js', '.ts', 'jsx', '.tsx'], plugins: [ new TsConfigPathsPlugin({ configFile: path.join(process.cwd(), 'tsconfig.json'), }), ], }, optimization: { minimize: false, }, plugins: [ new webpack.HotModuleReplacementPlugin(), new HtmlWebpackPlugin({ filename: 'index.html', template: path.join(process.cwd(), 'public/index.html'), // favicon: path.join(process.cwd(), 'public/favicon.png'), chunks: ['vendor', 'main'], inject: true, }), new webpack.DefinePlugin({ __DEVELOPMENT__: true, __DEVTOOLS__: true, }), // new webpack.ProvidePlugin({ // jquery: path.join(process.cwd(), 'js/utils/zepto/zepto.min'), // }), // new BundleAnalyzerPlugin(), new ForkTSCheckerWebpackPlugin({ async: true, typescript: { enabled: true, mode: 'write-references', // profile: true, }, }), new WebpackBar({ // profile: true, name: require(path.join(process.cwd(), 'package.json')).name || 'client', }), new CaseSensitive(), new FriendlyErrorsWebpackPlugin(), new AntdDayjsWebpackPlugin({ replaceMoment: true, plugins: [ 'isSameOrBefore', 'isSameOrAfter', 'advancedFormat', 'customParseFormat', 'weekday', 'weekYear', 'weekOfYear', 'isMoment', 'localeData', 'localizedFormat', 'badMutable', 'isoWeek', 'dayOfYear', 'duration', 'relativeTime', 'isBetween', 'minMax', ], }), ], module: { noParse: [/jszip.js$/], rules: [ { test: /\.(t|j)sx?$/, use: [ 'cache-loader', { loader: 'thread-loader', // loaders with equal options will share worker pools options: { // the number of spawned workers, defaults to (number of cpus - 1) or // fallback to 1 when require('os').cpus() is undefined workers: 2, // number of jobs a worker processes in parallel // defaults to 20 workerParallelJobs: 50, // additional node.js arguments workerNodeArgs: ['--max-old-space-size=1024'], // Allow to respawn a dead worker pool // respawning slows down the entire compilation // and should be set to false for development poolRespawn: false, // timeout for killing the worker processes when idle // defaults to 500 (ms) // can be set to Infinity for watching builds to keep workers alive poolTimeout: 2000, // number of jobs the poll distributes to the workers // defaults to 200 // decrease of less efficient but more fair distribution poolParallelJobs: 50, // name of the pool // can be used to create different pools with elsewise identical options name: 'js-thread-pool', }, }, { loader: 'babel-loader', options: { cacheDirectory: true, }, }, ], exclude: /node_modules/, include: [path.resolve('js'), path.resolve('framework'), path.resolve('packages')], }, { test: /\.css$/, use: ['style-loader', 'css-loader'], }, { test: /\.less$/, use: [ 'style-loader', 'css-loader', { loader: 'less-loader', options: { javascriptEnabled: true, modifyVars: theme, }, }, ], }, { test: /\.(jpeg|png|jpg|gif|pdf|mp3|ogg|wav)$/, use: ['file-loader?name=[path][name].[ext]'], }, { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: ['url-loader?limit=10000&mimetype=application/font-woff'], }, { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: ['file-loader'], }, ], }, performance: { hints: false, }, devServer: { quiet: true, contentBase: process.cwd(), port: process.env.PORT || 3000, host: '0.0.0.0', hot: true, compress: true, stats: { colors: true, assets: false, modules: false, children: false, }, historyApiFallback: true, }, }); 把你刚才的改动放入文件中
06-07
"error: 无法编译MEX函数"是Matlab中经常遇到的错误之一。该错误表示在编译MEX函数时出现了问题。可能的原因有以下几种: 1. 缺少适当的编译器:在使用Matlab编译MEX函数之前,需要确保已经安装了适当的编译器。Matlab支持多种编译器,例如Microsoft Visual Studio、GCC等。请检查所使用的编译器是否正确安装并配置。 2. 编译器版本不兼容:Matlab要求编译器的版本与Matlab版本兼容。如果编译器版本不正确,可能会导致编译失败。请确认所使用的编译器版本是否与Matlab版本兼容。 3. 缺少依赖文件:MEX函数可能依赖于其他文件或库。如果编译时缺少这些依赖文件,也会导致编译失败。请确保所有依赖文件已正确安装并在编译时指定它们的路径。 4. 编译选项错误:在编译MEX函数时,需要指定一些编译选项,例如编译器标志、库路径等。如果这些选项设置不正确,也会导致编译失败。请仔细检查编译选项是否正确设置。 5. 代码错误:最后,编译MEX函数时可能存在代码错误。请检查代码是否正确、完整,是否包含语法错误或逻辑错误。 解决这个错误的方法包括:确认编译器是否正确安装和配置、检查编译器版本是否兼容、确保所有依赖文件已正确安装和路径正确、检查编译选项设置是否正确、以及仔细检查MEX函数的代码是否存在错误。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值