(function(){
'use strict';
const container = document.getElementsByClassName('box-wrapper')[0];
var file = require("../views/images/diamond.png");
const bgImage={
'background-image': 'url(' + file + ')',
'background-position': 'center',
'background-repeat': 'no-repeat',
'background-size': 'contain'
};
)
错误:
ERROR in ./views/images/diamond.png
Module build failed: Error: Cannot find module '../build/Release/sharp.node'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous>
当尝试在js文件中导入图像并运行webpack时显示错误。如何克服这个问题?