Webpack bundle-loader trying to load non-existent file -
i'm trying use webpack's bundle-loader asynchronously load pikaday datepicker component (i want load pikaday on pages use it). seems i've managed build working correctly -- additional js file generated includes pikaday, , base bundle not -- code bundle-loader generates request new file looks incorrect url.
the relevant code looks this:
my datepicker component imports pikaday bundle-loader: import pikadayloader 'bundle!pikaday';
. uses so
pikadayloader(pikaday => { this.picker = new pikaday({ field: react.finddomnode(this.refs.dummyinput) }); });
my webpack config has output
looks this:
output: { path: path.join(__dirname, '../sandbox', 'dist'), filename: 'app.js' },
so js files being built dist
directory within sandbox
project. page uses scripts sandbox/index.html
.
when build code, pikaday bundle indeed generated @ sandbox/dist/2.app.js
. but webpack-generated loader looks @ sandbox/2.app.js
-- without dist
-- , therefore doesn't find it. code doesn't work.
can webpack experts me out here?
(because of history webpack, i'm guessing confusion related unclear documentation, rather bug -- if think bug, let me know , file issue.)
--- more ---
looks same thing happening if try use pete hunt's method (require.ensure(..)
) describe here instead of bundle-loader
. again, there request being made /2.app.js
instead of intended /dist/2.app.js
.
so seems problem how tell loaders in dist/
.
publicpath
need.
output: { path: path.join(__dirname, '../sandbox', 'dist'), publicpath: '/dist', // absolute path index.html ... }
Comments
Post a Comment