我想要一个像这样的图像:
const img = require('Flag');
它刚刚失败。
这是我的webpack.config.js:
module.exports = {
entry: './app/app.jsx',
output: {
path: __dirname,
filename: './public/bundle.js'
},
resolve: {
root: __dirname,
alias: {
Game: 'app/components/Game.jsx',
Board: 'app/components/Board.jsx',
Row: 'app/components/Row.jsx',
Cell: 'app/components/Cell.jsx',
Flag: 'app/components/flag.png',
},
extensions: ['', '.js', '.jsx', '.png']
},
module: {
loaders: [
{
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0']
},
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/
},
{
test: /\.(png|jpg)$/,
loader: 'url?limit=25000'
}
]
},
};