0

I'm trying to build 2 output files with the same content. One tagged with the version number (taken from package.json) and second tagged with "latest".

My (simplified) configuration looks like this:

var webpack = require('webpack');
var path = require('path');
var version = require('./package.json').version;

module.exports = {
  entry: {
    js: './src/main.js'
  },
  output: {
    path: path.resolve('./dist/sdk'),
    filename: [`oc-sdk-${version}.js`, 'oc-sdk-latest.js']
  }
}

But this isn't currently supported by webpack. I'm getting this error: configuration.output.filename should be a string

Is there a way to do this? Using a plugin or something?

Thanks for any advice or suggestion!

1 Answer 1

1

I think it would fall outside Webpack's duties.

Instead I'd suggest you to add a couple of lines to your build setup to copy/rename your files.

on-build-webpack plugin, for example, provides you a callback which is fired after the build task is completed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.