Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.62k stars 600 forks source link

Using `globalObject: 'this'` in ejected CRA webpack.config.dev breaks the webpack-dev-server #53

Closed ror-y closed 6 years ago

ror-y commented 6 years ago

Description of Issue

I am trying to set up a WatermelonDB project for web, by reading the documentation here. I set up a create-react-app app and ejected (by running the eject script) to allow me to edit the webpack.config.dev file so that I can add the necessary lines of code. However, the build breaks when I add globalObject: 'this' to the output object.

Error message in console

> $ npm start                                                                                                                                                                                        

> watermelon-test@0.1.0 start /Users/rorysmith/WebstormProjects/watermelon-test
> node scripts/start.js

Failed to compile.

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.output has an unknown property 'globalObject'. These properties are valid:
   object { auxiliaryComment?, chunkFilename?, crossOriginLoading?, chunkLoadTimeout?, devtoolFallbackModuleFilenameTemplate?, devtoolLineToLine?, devtoolModuleFilenameTemplate?, filename?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateFunction?, hotUpdateMainFilename?, jsonpFunction?, library?, libraryTarget?, libraryExport?, path?, pathinfo?, publicPath?, sourceMapFilename?, sourcePrefix?, strictModuleExceptionHandling?, umdNamedDefine? }
   Options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.

Expected Behaviour

webpack-dev-server not to crash.

Current Behaviour

webpack-dev-server crashes.

Possible Solution

Adding globalObject to the API schema. How do I do this? I don't know much about webpack.

Context (Environment)

create-react-app 1.5.2 which uses react 16.5.2, webpack 3.8.1 and webpack-dev-server 2.11.3.

ror-y commented 6 years ago

Closing, abandoning using CRA in favour of a lighter boilerplate.