Ilya Goncharov [JB]
06/24/2019, 3:29 PMERROR in ....
Module not found: Error: Can't resolve 'foo/bar.svg' in ...
Roman Artemev [JB]
06/24/2019, 3:47 PMsnrostov
06/24/2019, 3:53 PMwebpack.config.d
directory under project root, for example:
const path = require("path");
config.module.rules.push(
{
test: /\.svg$/,
loader: "svg-inline-loader",
options: {removeSVGTagAttrs: false},
include: [
path.resolve(require.resolve("@jetbrains/logos"), "..", "..")
]
}
);
See https://github.com/snrostov/kfsad/tree/6e3194d8db9ae99786771fdfeecd6293710a04e6/client/webpack.config.d for more details.
Feel free to create issue and describe your use case.Ilya Goncharov [JB]
06/24/2019, 4:14 PMIlya Goncharov [JB]
06/24/2019, 4:14 PMsnrostov
06/24/2019, 4:32 PMGurupad Mamadapur [FH]
12/13/2019, 2:53 PMpath.resolve(require.resolve("@jetbrains/logos")
Say I have SVG files under src/main/resources/img
folder. What should be used?Ilya Goncharov [JB]
12/13/2019, 3:01 PMsvg-inline-loader
path.resolve(require.resolve("@jetbrains/logos")
this line says find @jetbrains/logo
and get path to it
If you have svg in your resources, now we copy resources to build
directory, you can use through webpack.config.d
`path.resolve(__dirname, “<relative-path-to-your-resources-relative-to `build/js/packages/your-module-name`”)Gurupad Mamadapur [FH]
12/13/2019, 3:31 PMbuild/processedResources/Js/main/img/
Should I put this path and ask webpack to find the resources here? Sorry, I know very little of webpack and js.Ilya Goncharov [JB]
12/13/2019, 3:32 PMbuild/js/packages
- is in root project build
level, but processedResources
is in subproject level
While you have single project, it is no matterIlya Goncharov [JB]
12/13/2019, 3:38 PMrequire
external function (standard way in js)
external fun require(module: String): String
for example
And then in code
val svg = require('my.svg')