通过 webpack 运行我的代码后,它包含箭头函数。我需要代码在 ie11 中工作,所以我需要摆脱箭头函数。
我正在为所有 .js 文件使用 babel-loader。
我写了一个加载器来检查箭头函数的代码,并在 babel-loader 之后运行它,但没有得到任何箭头函数,所以我知道 babel 的输出是好的。
我还尝试了 babel-polyfill 和用于转换箭头功能的 babel 插件。
我知道 babel-loader 输出好的代码,我怀疑它可能是一个插件,但我不能只是禁用它们进行测试,因为这会破坏构建。
开发中使用的 Webpack 插件:
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
Run Code Online (Sandbox Code Playgroud)
这个问题也出现在 prod 中,但是在 …
javascript internet-explorer-11 webpack babeljs arrow-functions
我正在使用外部.pas文件中的函数.我可以使用一些功能,但不能使用其他功能.据我所知,函数声明方式相同,我想发布一些文件,但不知道发布大量代码.
我包括这样的glfw:
ExternalProject_Add(glfw-external
URL https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.zip
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/glfw
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/install
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
)
add_dependencies(ShittyLife glfw-external)
if(UNIX)
set(GLFW_LIB <What to put here?> libglfw3.a)
else()
set(GLFW_LIB ${install_dir}/lib/glfw3.lib)
endif()
Run Code Online (Sandbox Code Playgroud)
稍后使用GLFW_LIB变量链接lib.
它在Windows上运行良好,但在Linux上我缺少一些库.glfw网页提供了解决方案,但它们似乎都没有与ExternalProject_add的兼容性.
关于如何弄清楚所需的库是什么的任何想法,最好是以跨不同机器/发行版的方式工作?
如果它有用,这是我在尝试构建时遇到的错误:
相关位:
/usr/bin/ld: /home/molion/Desktop/ShittyLife/build/install/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
Run Code Online (Sandbox Code Playgroud)
所有的:
[ 94%] Building CXX object CMakeFiles/ShittyLife.dir/src/main.cpp.o
[100%] Linking CXX executable ShittyLife
/usr/bin/ld: /home/molion/Desktop/ShittyLife/build/install/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status …Run Code Online (Sandbox Code Playgroud)