JavaScript ဘန်ဒဲများတွင် Webpack ၏ Assets များ
၎င်း .png ဖိုင်များအတွက်
assets များကို စီစဉ်ပါစို့။
webpack.config.jsexport default {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve('dist')
},
module: {
rules: [
{
test: /\.png$/,
type: 'asset/resource'
}
]
},
plugins: [
new HtmlWebpackPlugin(),
],
};
.png ဖိုင်ကို entry point သို့
ချိတ်ဆက်ပါမည်။
src/index.jsimport img from './images/main.png';
img ကိန်ရှင်ထဲသို့ ရုပ်ပုံဖိုင်၏
လမ်းကြောင်းအသစ် ရောက်ရှိလာမည်။
src/index.jsconsole.log(img);
Задание 1
.jpg ဖိုင်များအတွက်
assets များကို စီစဉ်ပါ။
Задание 2
Entry point သို့ ရုပ်ပုံများစွာကို ချိတ်ဆက်ပါ။
Задание 3
Entry point ဖိုင်ထဲတွင် ရုပ်ပုံများ၏ လမ်းကြောင်းအသစ်များကို ထုတ်ပြပါ။