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

Want to have files in root #657

Closed
visualcookie opened this issue Apr 6, 2017 · 5 comments
Closed

Want to have files in root #657

visualcookie opened this issue Apr 6, 2017 · 5 comments

Comments

@visualcookie
Copy link

Hi,

I currently have a lot of files, which are normally meant to be in the ROOT directory of the project, inside the static directory. Now I literally have no idea, how to get these files to be in the ROOT directory, when the project is going to get builded.

Any1 got a solution for me?

@visualcookie
Copy link
Author

Fixed it myself by adding a directory root/, copying the files over there and extending webpack.prod.conf.js copytask with this:

    new CopyWebpackPlugin([
      {
        from: path.resolve(__dirname, '../static'),
        to: config.build.assetsSubDirectory,
        ignore: ['.*']
      },
      {
        from: path.resolve(__dirname, '../root'),
        to: config.build.assetsRoot,
        ignore: ['.*']
      }
    ])

@askmike
Copy link

askmike commented Jul 6, 2018

For me the above solution from @visualcookie didn't work, getting this error:

Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] /Users/pear/projects/gekko-develop/web/vue/src/main.js: .apply is not a valid Plugin property

instead I had to move the CopyWebpackPlugin config into a new file vue.config.js like so:

const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
  configureWebpack: {
    plugins: [
      new CopyWebpackPlugin([
        {
          from: '../baseUIconfig.js',
          to: 'public/UIconfig.js'
        }
      ])
    ]
  }
}

See these docs: https://cli.vuejs.org/guide/webpack.html#simple-configuration

@visualcookie
Copy link
Author

@askmike Thanks for the response. It did work, but my post is from last year, so yeah... version has changed and such.

@askmike
Copy link

askmike commented Jul 11, 2018 via email

@Gerben-T
Copy link

@askmike Extending the existing CopyWebpackPlugin with

{
    from: path.resolve(__dirname, '../root'),
    to: config.build.assetsRoot
}

worked for me.

new CopyWebpackPlugin([
        {
            from: path.resolve(__dirname, '../static'),
            to: config.build.assetsSubDirectory,
            ignore: ['.*']
        },
        {
            from: path.resolve(__dirname, '../root'),
            to: config.build.assetsRoot
        }
]),

VueJS ^2.5.2

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

3 participants