Closed sahibalejandro closed 6 years ago
Hi, version 1 of OpenRecord currently does not work with webpack or similar bundler. This is something I want to resolve in V2.
On development, using node -r babel-register server.js
to start a server with es6 imports and all other es6 stuff and using webpack-dev-middleware
works fine if i do:
Buffer.toString = () => 'any text unlikely used elsewhere' // Before using OpenRecord
export default new OpenRecord({
...,
models: path.join(__dirname, '..', 'models', '**', '*')
})
and using this on model files:
module.exports = function () { } // instead of export default
It seems a bug with babel when openrecord data_types.js
setting tries to use Buffer as a json key. Not so much related to this issue, but also a problem when trying to use OpenRecord with modern tools like babel.
I thought production code was working, but after seeing this issue, i compiled server code with webpack (although old version 1.12.14) to one file and same problem described by @sahibalejandro happens on Store.loadModels
> Utils.require
when i run compiled file. It is unable to find first model on folder:
Error: Cannot find module 'src/models/modelname.js'
version 2 will support webpack. Although without support to load models e.g. via models: path.join(__dirname, '..', 'models', '**', '*')
.
But I'm working on a webpack plugin to solve this
Any luck with the webpack plugin? Looking at v2 roadmap large backlog, the release seems too far away =(
Take a look at branch v2 or checkout openrecord@next
I‘ll Release Version 2 in the comming weeks!
Am 01.03.2018 um 22:11 schrieb arthurfranca notifications@github.com:
Any luck with the webpack plugin? Looking at v2 roadmap large backlog, the release seems too far away =(
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Hi, I'm getting this error when instantiating a new store with
new OpenRecord(...)
This is my code:
Am I doing something wrong?
I'm using webpack.