I am mostly a server side developer, so apologies in advance if my attempt to describe the problem seems weird.
I used the standard tutorial to setup a plugin using react. It all worked. Then I added the Semantic UI to power the accordion feature. This worked. But for some reason, when I try to use <Icon name='dropdown' />
component from Semantic UI, it just shows a placeholder with a question mark inside. I did the whole setup of the app outside of XD, and it all works as normal, I can see the icon being loaded properly. But within XD it does not work.
I include this in my component.
import 'semantic-ui-css/semantic.min.css'
import { Accordion, Icon } from 'semantic-ui-react'
My webpack.config.js has this loader, I also tried file-loader
.
{
test: /\.(ttf|woff|woff2|eot|png|svg|gif)$/,
use: {
loader: 'url-loader'
}
}
I am thinking there is something that might be overriding the font-family and breaking Sematic UI fonts being loaded properly. But I can’t debug this, since it seems XD plugin development is like a black box, the best I can do is view the Developer Console, but does not show much.
Here is the full webpack.config.js
const path = require('path');
module.exports = {
entry: __dirname + "/src/main.jsx",
output: {
path: __dirname,
filename: 'main.js',
libraryTarget: "commonjs2"
},
devtool: "none", // prevent webpack from using eval() on my module
externals: {
application: "application",
scenegraph: "scenegraph",
viewport: "viewport",
assets: "assets",
clipboard: "clipboard",
uxp: "uxp"
},
resolve: {
extensions: [".js", ".jsx"]
},
module: {
rules: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
plugins: [
"transform-react-jsx",
"transform-object-rest-spread",
"transform-class-properties"
]
}
}, {
test: /\.png$/,
exclude: /node_modules/,
loader: 'file-loader'
}, {
test: /\.css$/,
use: ["style-loader", "css-loader", "resolve-url-loader"],
include: [
path.join(__dirname, 'src'),
/node_modules/
]
}, {
test: /\.scss$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{ loader: "sass-loader" }
]
},
{
test: /\.(ttf|woff|woff2|eot|png|svg|gif)$/,
use: {
loader: 'file-loader'
}
}]
}
}