Closed
Description
Hi everyone, I've got a question about using different images loader than default. I want to copy images from ./src/assets/images/ to ./web/assets/images/, I know that default loader does that with every file included in .scss files, but not all of my image files are included in .scss files however I still want to copy them.
I have disabled it using disableImagesLoader() and tried using webpack-image-loader/copy-webpack-plugin with addLoader()/addPlugin(), but I've got this type of errors:
in ./src/assets/img/a.png
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
Here's my webpack.config.js
.setOutputPath('web/assets/')
.setPublicPath('/assets')
.cleanupOutputBeforeBuild()
.disableImagesLoader()
.addEntry('js/main', './src/assets/ts/main.ts')
.enableTypeScriptLoader(function (typeScriptConfigOptions) {
typeScriptConfigOptions.transpileOnly = false;
typeScriptConfigOptions.configFile = 'tsconfig.json';
})
.addStyleEntry('css/global', './src/assets/scss/theme.scss')
.addLoader({ test: /\.scss$/, loader: 'import-glob-loader' })
.enableSassLoader(function(sassOptions) {
sassOptions.includePaths = [ './src/assets/scss/*', './src/assets/scss/*/*' ],
sassOptions.outputStyle = 'compressed'
})
.enablePostCssLoader()
.autoProvidejQuery()
.enableSourceMaps(!Encore.isProduction());
I am aware about #24 but I haven't found an answer for that there.