0

I struggle setting up Wercker on a rails / Webpacker project.

I first had to add steps to install node, then another to pre-compile react packs, then to install yarn. First it was good but then I added dependencies to the project and know I'm stuck on 3 dependencies with the same error message :

ERROR in ./app/javascript/app/index.js
Module not found: Error: Can't resolve 'redux-thunk' in '/pipeline/source/app/javascript/app'
 @ ./app/javascript/app/index.js 5:0-32
 @ ./app/javascript/packs/app.js

That's happening only with redux-thunk, react-redux-i18n and react-spinkit

I've tried to add a step yarn install which passes through the process but doesn't solve the problem.

Here is my wercker.yml:

# wercker.yml
box: ruby:2.4.1

services:
    - redis
    - postgres

build:
    steps:
        - louischavane/install-phantomjs@0.0.5
        - rails-database-yml
        - script:
            name: nokogiri tricks
            code: bundle config build.nokogiri --use-system-libraries
        - bundle-install
        - bigtruedata/install-node@2.1.1
        - akupila/yarn@0.2.0
        - script:
            name: yarn-install
            code: yarn install
        - script:
            name: pre-compile react packs
            code: NODE_ENV=test bundle exec rails webpacker:compile
        - script:
            name: run migration
            code: rake db:migrate RAILS_ENV=test
        - script:
            name: load fixture
            code: rake db:fixtures:load RAILS_ENV=test
        - script:
            name: run rubocop
            code: bundle exec rubocop
        - script:
            name: test
            code: bundle exec rake test RAILS_ENV=test
adesurirey
  • 2,549
  • 2
  • 16
  • 36

1 Answers1

0

Found a way around adding a step to remove node modules before pre-compiling :

- script:
  name: delete node modules
  code: rm -rf node_modules

UPDATE

I now have a clean Wercker setup handling tests, system tests with chrome headless, rubocop, eslint and stylelint. You can find it here: https://gist.github.com/adesurirey/7c013bfa1a9bed9d56ffea54db5d6288

adesurirey
  • 2,549
  • 2
  • 16
  • 36