tr1s / tris-webpack-boilerplate

A Webpack boilerplate for static websites that has all the necessary modern tools and optimizations built-in. Score a perfect 10/10 on performance.
https://twbp.tris.codes/
MIT License
1.02k stars 97 forks source link

json files #15

Closed arbel closed 5 years ago

arbel commented 5 years ago

Hello,

I'm using Lottie and need to refrence a json file in my script. I tried placing it a few places in my src folder but when I preview the file I get a message that the json file cannot be found. is there something else I need to do in the config so I can use json assets?

arbel commented 5 years ago

this is my code 'var animation = bodymovin.loadAnimation({ container: document.getElementById('ui-anim'), renderer: 'svg', loop: true, autoplay: true, path: 'images/ui.json' });'

and I have a file ui.json in my src/images folder

arbel commented 5 years ago

found a post that this should fix the issue:

{ type: 'javascript/auto', test: /\.json$/, use: [ { loader: 'file-loader', options: { name: "[name].[ext]" outputPath: 'images/', publicPath: 'images/' } } ] },

but it didn't.... very new to webpack and pipelines.

thanks

tr1s commented 5 years ago

Did you figure it out? Maybe try json-loader.