Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to user backpack with multiple entries? #123

Open
gen4sp opened this issue Mar 19, 2018 · 1 comment
Open

Is it possible to user backpack with multiple entries? #123

gen4sp opened this issue Mar 19, 2018 · 1 comment

Comments

@gen4sp
Copy link

gen4sp commented Mar 19, 2018

I've tried using this configuration, and build seems to work, but dev doesn't.

I've tried backpack dev /src/another/one.js - it runs the script but without transcode.

I've found this solution, but it I thought maybe there is the better way.
What is the most right way to use the backpack with multiple entries?

Thank you!

@gen4sp
Copy link
Author

gen4sp commented Mar 20, 2018

I've ended up with following:

backpack.config.js

const entries = {
  api: './src/index.js',
  service: './src/service.js',
}
module.exports = {
  webpack: (config, options, webpack) => {
    delete config.entry.main;
    config.entry[process.env.BACKPACK_ENTRY] = [
      entries[process.env.BACKPACK_ENTRY],
    ]
    config.output.filename = process.env.BACKPACK_ENTRY+'.js';
    return config
  }
}

package.json scripts

"dev_api": "BACKPACK_ENTRY=api backpack dev",
"dev_service": "BACKPACK_ENTRY=service backpack dev",
"build_api": "BACKPACK_ENTRY=api backpack build",
"build_service": "BACKPACK_ENTRY=service backpack build"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant