webpack为什么不支持静态场?
当我尝试
export class Game {
#lasttime = 0;
#FRAME_DURATION = 1000 / 144;我犯了个错误
模块解析失败:意外的字符'#‘(2:4)您可能需要一个适当的加载程序来处理这个文件类型,目前还没有配置加载程序来处理这个文件。见https://webpack.js.org/concepts#loaders。有什么问题吗?
const path = require('path');
const HTMLPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
filename: 'js/main.js',
path: path.resolve(__dirname, 'dist'),
},
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
},
plugins: [
new HTMLPlugin({
template: './src/index.html'
})
],
};发布于 2020-11-20 11:41:07
https://webpack.js.org/guides/getting-started/#modules
注意: webpack不会修改除导入和导出语句之外的任何代码。如果您正在使用其他的ES2015功能,请确保使用一个转换程序,如Babel或Bublé,通过webpack的装载机系统。
您需要自己配置babel-加载程序,请参阅https://webpack.js.org/loaders/babel-loader/#root。
https://stackoverflow.com/questions/64928312
复制相似问题