src/index.js
import barfrom'./bar.js';bar();
src/bar.js
exportdefaultfunctionbar(){//}
Without config or provide customwebpack.config.js
const path=require('path');module.exports={ entry:'./src/index.js', output:{ path: path.resolve(__dirname,'dist'), filename:'bundle.js',},};
page.html
<!DOCTYPEhtml><html><head><metacharset="utf-8"/> ...</head><body> ...<scriptsrc="dist/bundle.js"></script></body></html>
Then runwebpack
on the command-line to createbundle.js
.
Get Started quickly in ourGuides section, or dig into theConcepts section for more high-level information on the core notions behind webpack.
Through contributions, donations, and sponsorship, you allow webpack to thrive. Your donations directly support office hours, continued enhancements, and most importantly, great documentation and learning material!