Giter VIP home page Giter VIP logo

Comments (9)

camdagr8 avatar camdagr8 commented on June 3, 2024

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 the gulp.config.js and is passed to the webpack.config

https://github.com/Atomic-Reactor/Reactium/releases/tag/2.3.9

from reactium.

jamsterdam29 avatar jamsterdam29 commented on June 3, 2024

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.

camdagr8 avatar camdagr8 commented on June 3, 2024

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.

jamsterdam29 avatar jamsterdam29 commented on June 3, 2024

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.

camdagr8 avatar camdagr8 commented on June 3, 2024

What version were you on previously?

from reactium.

camdagr8 avatar camdagr8 commented on June 3, 2024

There are a couple ways you can change the port in index.js

  1. By specifying: process.env.APP_PORT
  2. By specifying: process.env.PORT_VAR=MY_PORT_VAR then process.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.

camdagr8 avatar camdagr8 commented on June 3, 2024

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.

jamsterdam29 avatar jamsterdam29 commented on June 3, 2024

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.

jdillick avatar jdillick commented on June 3, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.