11const path = require ( "path" ) ;
2+ const webpack = require ( "webpack" ) ; // <-- ADDED: Required for the Replacement Plugin
23const CoCreateConfig = require ( "./CoCreate.config" ) ;
34const {
45 ModuleGenerator,
56 FileUploader,
6- SymlinkCreator
7+ SymlinkCreator,
8+ UnicodeLoader
79} = require ( "@cocreate/webpack" ) ;
810
911const MiniCssExtractPlugin = require ( "mini-css-extract-plugin" ) ;
@@ -18,7 +20,7 @@ module.exports = async (env, argv) => {
1820 } ,
1921
2022 output : {
21- path : path . resolve ( __dirname , "dist" ) ,
23+ path : path . resolve ( __dirname , "./src/ dist" ) ,
2224 filename : isProduction ? "[name].js" : "[name].js" ,
2325 chunkFilename : isProduction ? "[name].js" : "[name].js" ,
2426 library : "CoCreate" , // The name of your library globally
@@ -32,11 +34,22 @@ module.exports = async (env, argv) => {
3234 // Ensure your target environments support it or esbuild can transpile it adequately for your target.
3335 topLevelAwait : true
3436 } ,
35-
37+
3638 plugins : [
3739 new ModuleGenerator ( CoCreateConfig . modules ) ,
3840 new FileUploader ( env , argv ) ,
3941 new SymlinkCreator ( ) ,
42+
43+ // <-- ADDED: The Surgical Fix for npm link -->
44+ // Forcefully redirects any dynamic import of "CoCreate.config.js"
45+ // to the physical file in your project root, bypassing symlinks.
46+ new webpack . NormalModuleReplacementPlugin (
47+ / C o C r e a t e \. c o n f i g \. j s $ / ,
48+ function ( resource ) {
49+ resource . request = path . resolve ( __dirname , "./CoCreate.config.js" ) ;
50+ }
51+ ) ,
52+
4053 new MiniCssExtractPlugin ( {
4154 filename : isProduction ? "[name].min.css" : "[name].css" ,
4255 chunkFilename : ( pathData ) => {
@@ -128,4 +141,4 @@ module.exports = async (env, argv) => {
128141 } ;
129142
130143 return config ;
131- } ;
144+ } ;
0 commit comments