Comments (9)
Instead of doing that... I just merged in the ability to be able to inject overrides into the config functions.
const env = process.env.NODE_ENV || 'development';
const config = require('./.core/gulp.config')({
defines: {
'process.env': {
NODE_ENV: JSON.stringify(env),
VERSION: require('./package.json').version
}
}
});
const webpackConfig = require('./.core/webpack.config')(config, 'app', {
target: 'node'
});
Note that the
process.env
is actually defined in thegulp.config.js
and is passed to thewebpack.config
https://github.com/Atomic-Reactor/Reactium/releases/tag/2.3.9
from reactium.
great, will give that a try. Brings up a new question though, what is the prescribed process for updating version of reactium within my project?
from reactium.
Depends on which version you're running.
The latest version of arcli has an update function which will work from Reactium v 2.3.6+
arcli re:update
The update function will replace .core
with the latest version.
If you're on an older version, you should be able to copy your src to a new project w/o much hassle.
from reactium.
ok, got the latest version, but can't get it to override/set version. Always just has NODE_ENV='development'.
Not sure, but I saw a couple of weeks ago that the gulp config and webpack config are not overridable. Maybe because in core index.js in development mode it always pulls local configs? after local gulpfile has set overrides? (I figured it out at one pt, but can't exactly remember.
const gulpConfig = require('./gulp.config')();
const webpackConfig = require('./webpack.config')(gulpConfig);
Also, noticed in this new version, it keeps opening at port 3001, 3002, etc... but app is not at that port, still at 3000. Was fine before I updated version, so not sure...
from reactium.
What version were you on previously?
from reactium.
There are a couple ways you can change the port in index.js
- By specifying:
process.env.APP_PORT
- By specifying:
process.env.PORT_VAR=MY_PORT_VAR
thenprocess.env.MY_PORT_VAR=9000
Injecting into the gulp.config
is primarily for altering gulp tasks, not the .core/index.js
.
If you're just trying to pass a version into your app, import the package.json and get the version number from there.
from reactium.
We purposely pushed away from altering the .core/index.js
and loading config outside of it to ensure a clean upgrade path. If you're doing things that require a lot of hacking into the .core/index.js
, you may want to take a look at your app's architecture and think about other ways to execute your goals.
from reactium.
I think I was on .6 before. That fine, not trying to hack index.js (yet :)). Just looking at how we do what were doing in Reactium 1 under Reactium 2. Your override suggestion made me think it was possible from the gulpfile. But will go another way.
On the port issue. I believe it is set to 3000, and serving under 3000, but opening browser at 3001. I saw something where was incrementing by 1 to wait for server to start or something. Thought was related to that, but not sure.
from reactium.
@jamsterdam29 So, current facility in core Reactium (latest - run arcli re:update
) is to create a defines.js in your src/app/server folder that exports a plain object.
e.g. src/app/server/defines.js
module.exports = { version: process.env.npm_package_version, };
This will add a "version" define plugin to webpack (good for client-side rendering only), as well as add to window.defines.version if you are using the .core html templates.
The gulp overrides won't work in this context, because that's only employed during production build for js bundle. During local development, webpack overrides in gulpfile.js are ignored.
from reactium.
Related Issues (11)
- Feature: Local Development - Auto Port
- Action required: Greenkeeper could not be activated 🚨
- Cannot init new full-stack project HOT 1
- Toolkit content styles not reloading on change HOT 3
- Optionally Package Styles with Webpack HOT 1
- Rendering Top-Level component in SPA HOT 2
- Beautify Module is not IE11 compatible HOT 1
- "order" attribute in route causing production error HOT 1
- Ability to add to webpack entry list HOT 5
- Toolkit Path
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactium.