-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
The plugin shorthand syntax does not (cannot?) work with Browserify #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmmm... I guess the shorthand is only for Component-based projects then. I will clarify that in the spec. |
Same for Vue.require: A (really ugly) solution could be to require all the modules relevant for plugins in main.js… |
Yeah this is actually one of the reasons I use Component over Browserify... let me think about this. |
Maybe a dedicated plugin API could be provided (and documented), instead of exposing all the internal components: // plugin-api.js
module.exports = {
utils: require('./utils'),
// relevant modules
} // main.js
var pluginApi = require('./plugin-api')
ViewModel.require = function (path) {
return pluginApi[path]
} |
You could try commonjs-everywhere |
I'm actually thinking of shipping built versions for npm instead. This would allow me to get rid of the emitter hack and also split observer into its own package. |
Scrap that - browserify attempts to parse all the requires inside and throws compile time error. |
Yup, Browserify attempts to parse on bundle, making dynamic paths
etc. On Fri, Feb 21, 2014 at 8:56 PM, Evan You notifications@github.com wrote:
|
So here's all modules that are exposed for plugins: |
I think it may also true for a require.js setup when you use the almond shim. |
For instance var utils = require('./utils')
// become
var utils = require("yyx990803~vue@v0.10.5/src/utils.js") Could be fixed like @bpierre has suggested: var modules = {
utils: utils,
config: config,
transition: require('./transition'),
observer: require('./observer')
};
ViewModel.require = function (path) {
return modules[path]
} |
yeah, that might be the better way to go. open to PRs! |
Browserify can only analyze static requires: browserify/browserify#377 (comment)
The text was updated successfully, but these errors were encountered: