markmarijnissen / webpack-cordova-plugin

Output webpack to a Cordova app.
65 stars 20 forks source link

Docs clarification #12

Open Birowsky opened 7 years ago

Birowsky commented 7 years ago

From the docs:

Create an index.html and make sure this is copied to your output: require('file?name=index.html!./index.html');

What does "copied to your output" mean exactly?

TCMiranda commented 7 years ago

It is just the way webpack works.

It takes some javascript entry and output it to some directory.

Normally output directory wont contain the html entry file. In order to "copy" the html to the same directory as the Javascript, you need to require('file?name=index.html!./index.html');

This happens because of the file-loader, which takes a file and copy it to the webpack output folder: https://github.com/webpack-contrib/file-loader

Note that this is a recommendation. You could just write your index.html somewhere else, and move the files together before bundling.