Closed wastaz closed 7 years ago
Yeah, I guess UMD doesn't play very well with static analysis, but it has the big advantage we can use it for asynchronous loading in the web with requirejs
without any additional fable-core
distro.
Luckily we should be able to stop worrying about the UMD distro when bundling soon. Have you tried the ES2015 distro (the default fable-core
) with Webpack 2? Does it work well?
Es2015 modules seem to work fine with webpack2 lateley.
@alfonsogarciacaro How do I test with the es2015 distro? I cant seem to figure it out :/
@wastaz Use 2015
as the --module
target. Actually, as this is now the default you can also omit directly the --module
compiler option. This way Fable will compile everything with ES2015 modules and also use the ES2015 distro of fable-core
:+1:
Hmm, nope. That just blows up webpack in a different way... :( Why does webpack always have to be such a problem! :P
Module parse failed: E:\Users\Fred\gitrepos\fable-bindings\fable-reactredux-todomvc-sample\Fable.ReactRedux.TodoMvc\node_modules\react-hot-loader\index.js!E:\Users\Fred\gitrepos\fable-bindings\fable-reactredux-todomvc-sample\Fable.ReactRedux.TodoMvc\node_modules\babel-loader\lib\index.js!E:\Users\Fred\gitrepos\fable-bindings\fable-reactredux-todomvc-sample\Fable.ReactRedux.TodoMvc\node_modules\source-map-loader\index.js!E:\Users\Fred\gitrepos\fable-bindings\fable-reactredux-todomvc-sample\Fable.ReactRedux.TodoMvc\temp\index.js 'import' and 'export' may only appear at the top level (3:0)You may need an appropriate loader to handle this file type.
SyntaxError: 'import' and 'export' may only appear at the top level (3:0)
.....
Managed to get latest RC of webpack2 up and running and can verify that both --module 2015
and --module commonjs
seems to work fine. These warning no longer appears and from what I can see stuff is working properly.
It's still too bad that I cant seem to get it to work with webpack 1 given that 2 still doesnt have a stable release and 1 will be around for quite some time. But at least it does work with webpack2! :/
Since webpack2 has a stable release now I think that this is probably not as important anymore so feel free to ignore this (or re-open it if you think that it's still something useful).
Description
Using latest version of webpack 1 (and also tested on webpack 2 with pretty much the same result). When Im using webpack to bundle a fable app I get a ton of warnings about stuff from fable-core (later versions, older versions still work without any warning).
Those are not the only warnings, I think it might be one warning per file in fable-core/umd to be honest, but Im not entirely sure since I havent counted.
Repro code
Use latest version of fable-core and webpack. It's reproducible in my repository https://github.com/wastaz/fable-reactredux-todomvc-sample in the Fable.ReactRedux.TodoMvc project (given that you update the fable-core version in it of course).