Use Meteor's client Packages in a non Meteor project
MIT License
Use Meteor's client packages side in a non Meteor project.
The packages given are :
and all the individual depedencies.
npm install --save [email protected]
for Meteor 1.3.5
npm install --save [email protected]
for Meteor 1.3.5.1
npm install --save [email protected]
for Meteor 1.4
npm install --save [email protected]
for Meteor 1.4.0.1
npm install --save [email protected]
for Meteor 1.4.1
npm install --save [email protected]
for Meteor 1.4.1.1
npm install --save [email protected]
for Meteor 1.4.1.2
npm install --save [email protected]
for Meteor 1.4.1.3
npm install --save [email protected]
for Meteor 1.4.2
npm install --save [email protected]
for Meteor 1.4.2.1
To define __meteor_runtime_config__
global variables you can make a meteor-runtime-config.js
file in your root.
The following is the default if empty :
export const __meteor_runtime_config__ = {
meteorEnv: {},
DDP_DEFAULT_CONNECTION_URL: 'http://localhost:3000',
PUBLIC_SETTINGS: {
__global_scope__: false
}
};
DDP_DEFAULT_CONNECTION_URL
__global_scope__: true
.To use with webpack you have to add the following code at the end of your webpack.config.js
file :
config = generateConfig(
config,
require('meteor-client-packages/easy-webpack')()
);
[name]
have to be in the filename of css files of shunks :
require('@easy-webpack/config-css')
({ filename: '[name].styles.css', allChunks: true, sourceMap: false }),
It makes it possible to import the packages as in Meteor 1.3+ :
import { Meteor } from 'meteor/meteor';
import { DDP } from 'meteor/ddp';
meteor-client-packages/easy-webpack
has tow optional parameters :
The packages bundled by webpack are only those imported by your code with their dependencies.
The version of this package takes the same version as the Meteor version for witch the Meteor packages have been compiled.
meteor-client-packages-meteor version : 1.3.5-0.x.x <== Meteor version : 1.3.5
meteor-client-packages-meteor version : 1.3.5-1.x.x <== Meteor version : 1.3.5.1
meteor-client-packages-meteor version : 1.4.0-0.x.x <== Meteor version : 1.4
meteor-client-packages-meteor version : 1.4.0-1.x.x <== Meteor version : 1.4.0.1
meteor-client-packages-meteor version : 1.4.1-0.x.x <== Meteor version : 1.4.1
meteor-client-packages-meteor version : 1.4.1-1.x.x <== Meteor version : 1.4.1.1
meteor-client-packages-meteor version : 1.4.1-2.x.x <== Meteor version : 1.4.1.2
meteor-client-packages-meteor version : 1.4.1-2.x.x <== Meteor version : 1.4.1.3
meteor-client-packages-meteor version : 1.4.2-0.x.x <== Meteor version : 1.4.2
meteor-client-packages-meteor version : 1.4.2-1.x.x <== Meteor version : 1.4.2.1
You have to use this NPM Package as a model. To change the packages to include you have to :
__src__\packages
witch has to include the Meteor packages name you need__src__\meteor-version
to compile to the good version of Meteor when this makes sense__src__\meteor-packages-meteorVersion
to define dependencies and package-version
dependencies
of the package.json
file, replace meteor-client-packages
by meteor-client-packages-meteor
npm run build
or npm start
git add *
, git commit -m "new version"
, git push
and npm publish
Don't include a Meteor package already in this NPM package in the file __src__\meteor-packages-meteorVersion.json
.
Your have to create your NPM package with a name like meteor-client-packages-...
.
All the meteor-client-packages-...
NPM packages are loaded by webpack to define the aliases of the Meteor packages.
The code is in the native compiled version of Meteor for a given version.
I wanted to be able to use meteor's modules with webpack using import {...} from 'meteor/...'
.