I've tried:
chainWebpack: config => {
config.merge({
module: {
rules: [{
test: /\.jsx?$/,
exclude: {
exclude: [path.resolve(__dirname, "public/my-config.js")]
}
}]
}
})
}
Or
config.module.rule('js')
.exclude({
exclude: path.resolve(__dirname, "public/my-config.js")
})
But it doesn't work.
I want to either import public/my-config.js with script tag in the pages/index.html or just import { config1, config2 } from '../public/my-config'.
I was able to use externals to not include a module in webpack though, but it's not quite intuitive with Vue.js.
I must have the my-config.js be available at dist/ so that it can be edited.
publicdir contains files that are only copied, not processed by webpack, which seems to be what you want. And it wouldn't make sense to exclude it from processing, since that should already be done. What are you really trying to exclude the file from?vue inspect > output.jsthat there isCopyWebpackPluginthat hasfrom: '/path/to/my_project/public', to: '/path/to/my_project/dist'andignore: ['index.html', '.DS_Store']. What I want to do is to not include themy-config.jsfile, but havemy-config.js.gitkeepfile and let the user create his/hers ownmy-config.jsfile by copying the filecp my-config.js.gitkeep my-config.js. I'll be using my ownmy-config.jsfile as well.dist/andpublic/my-config.jsin.gitignorewhich is the case, but I want to know about how to exclude a file, well, I guess specifically those that are in thepublicdirectory.