Skip to content

Instantly share code, notes, and snippets.

@theory-of-soul
Last active June 18, 2020 03:17
Show Gist options
  • Save theory-of-soul/0d68496f0b0ebbec015d712204277373 to your computer and use it in GitHub Desktop.
Save theory-of-soul/0d68496f0b0ebbec015d712204277373 to your computer and use it in GitHub Desktop.
Selectize.js + Angularjs settings for webpack
// install separate:
// yarn add sifter
// yarn add microplugin
// and add this in config =>
module.export = {
...
plugins: [
...
new webpack.ProvidePlugin({
...
Selectize: 'selectize/dist/js/standalone/selectize',
})
...
],
resolve: {
...
alias: {
'MicroPlugin': root('node_modules/microplugin'),
'Sifter': root('node_modules/sifter')
}
},
module: {
rules: [
{
test: require.resolve('sifter'),
use: [
'imports-loader?define=>false,exports=>false,this=>window',
'exports-loader?Sifter',
],
},
{
test: require.resolve('microplugin'),
use: [
'imports-loader?define=>false,exports=>false,this=>window',
'exports-loader?MicroPlugin',
],
},
{
test: require.resolve('selectize/dist/js/standalone/selectize'),
use: [
'imports-loader?this=>window,MicroPlugin,Sifter',
'exports-loader?Selectize',
],
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment