Comments (8)
I don't think 'carbon-icons-svelte/Home16'
is a valid import.
The JS import path should be "carbon-icons-svelte/lib/Home16"
.
from carbon-preprocess-svelte.
Just a typo, I manually typed this up. Updated my comment
from carbon-preprocess-svelte.
you get the same problem that would occur when not using
optimizeImports
in your preprocess section
Are you using optimizeImports
? It should automatically optimize imports from carbon-components-svelte
, carbon-icons-svelte
, and carbon-pictograms-svelte
.
from carbon-preprocess-svelte.
Yep, I'm using optimizeImports
.
preprocess: [
sveltePreprocess({
scss: {
includePaths: ['src']
},
postcss: {
plugins: [autoprefixer]
}
}),
optimizeImports()
]
The issue is I think that this isn't invoked when it's not parsing svelte files directly, I have a svelte file that references a store, the store references a service which will build a nav based on the current user and some other state related things.
Importing an icon in a .svelte file works fine, importing via the service causes extreme lag (unless I manually change the import to the full path)
With a brief look at the source, optimizeImports uses svelte's createPreprocessorFromVitePlugin to create a Preprocessor specifically for the svelte compiler. I think what I need is something that does the equivalent for TS / JS files.
from carbon-preprocess-svelte.
With a brief look at the source, optimizeImports uses svelte's createPreprocessorFromVitePlugin
Could you clarify this?
from carbon-preprocess-svelte.
Looking at /node_modules/carbon-preprocess-svelte/dist/index.js@22895
optimizeImports
returns the result of the call to script
I assumed (probably incorrectly now that I look closer) that it used the script prop from createVitePreprocessorGroup
, I am not overly familiar with the code so am most likely making bad assumptions.
In fact, I'm now assuming that's declaring a script method for the returned object which gets invoked by svelte's compiler at some point.
from carbon-preprocess-svelte.
In fact, I'm now assuming that's declaring a script method for the returned object which gets invoked by svelte's compiler at some point.
This is the correct assumption.
The optimizeImports
will preprocess script blocks: https://github.com/carbon-design-system/carbon-preprocess-svelte/blob/main/src/preprocessors/optimize-imports.ts#L13
from carbon-preprocess-svelte.
Ok, in which case, what I need is a way to do the same for script files
from carbon-preprocess-svelte.
Related Issues (20)
- Generic support for other libraries HOT 2
- Some styles are lost after optimizeCss()
- optimizeCarbonImports breaks sveltekit hydration
- HeaderSearch has wrong styling when compiled HOT 6
- ParseError with scss inside component HOT 2
- optimizeCss removes carbon-charts css HOT 2
- Unexpected Token Error when importing types HOT 8
- `optimizeImports` incompatible with Carbon icons v11 HOT 4
- Optimize Css problem HOT 2
- Using optimizeImports() with SvelteKit causes error 500 `Unexpected token 'export'` HOT 6
- Notification breaks optimizeCss() HOT 1
- `elements` cannot process CSS variables
- Run optimizeImports for all imports on dev server start HOT 4
- Using optimizeCss with tailwind breaking css in sveltekit. HOT 1
- Docs and e2e examples are out of date HOT 1
- Got Error: Unexpected option config.kit.vite when execute yarn dev HOT 3
- Svelte 4 compatibility for peer dependencies HOT 3
- Request fix optimizeImport module support carbon-icon-component v12 HOT 1
- This library needs a rewrite HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carbon-preprocess-svelte.