diff --git a/app/helpers/vite-require-helper.php b/app/helpers/vite-require-helper.php
index d4d6b40..8375abc 100644
--- a/app/helpers/vite-require-helper.php
+++ b/app/helpers/vite-require-helper.php
@@ -13,8 +13,8 @@ class ViteRequireHelper
function __construct()
{
add_action('wp_enqueue_scripts', [$this, 'enqueue_common_scripts']);
- add_action('wp_enqueue_scripts', [$this, 'enqueue_development_scripts']);
- // add_action('wp_enqueue_scripts', [$this, 'enqueue_production_scripts']);
+ // add_action('wp_enqueue_scripts', [$this, 'enqueue_development_scripts']);
+ add_action('wp_enqueue_scripts', [$this, 'enqueue_production_scripts']);
// add tag filters
add_filter('script_loader_tag', [$this, 'script_tag_filter'], 10, 3);
add_filter('style_loader_tag', [$this, 'style_tag_filter'], 10, 3);
@@ -32,15 +32,15 @@ class ViteRequireHelper
$manifest = $this->get_manifest_file();
//
- wp_enqueue_script('[type:module]chunk-vendors.js', $assets_base_path . $manifest['index.html']['file'], array(), null, false);
+ wp_enqueue_script('[type:module]chunk-vendors.js', $assets_base_path . $manifest['src/main.ts']['file'], array(), null, false);
//
- foreach ($manifest['index.html']['imports'] as $index => $import) {
+ foreach ($manifest['src/main.ts']['imports'] as $index => $import) {
wp_enqueue_style("[ref:modulepreload]chunk-vendors-{$index}.js", $assets_base_path . $manifest[$import]['file']);
}
//
- foreach ($manifest['index.html']['css'] as $index => $path) {
+ foreach ($manifest['src/main.ts']['css'] as $index => $path) {
wp_enqueue_style("sakura-chunk-{$index}.css", $assets_base_path . $path);
}
}
@@ -52,7 +52,7 @@ class ViteRequireHelper
wp_enqueue_style('fontawesome-free', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/all.min.css');
// TODO: don't use vue.js as handler
- wp_enqueue_script('vue.js', 'https://unpkg.com/vue@next', array(), false, true);
+ wp_enqueue_script('vue.js', 'https://unpkg.com/vue@next', array(), false, false);
wp_localize_script('vue.js', 'InitState', (new Controllers\InitStateController())->get_initial_state());
diff --git a/index.html b/index.html
deleted file mode 100644
index 11603f8..0000000
--- a/index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
- Vite App
-
-
-
-
-
-
diff --git a/public/.gitkeep b/public/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/public/favicon.ico b/public/favicon.ico
deleted file mode 100644
index df36fcf..0000000
Binary files a/public/favicon.ico and /dev/null differ
diff --git a/src/admin/App.vue b/src/admin/App.vue
new file mode 100644
index 0000000..dee38f4
--- /dev/null
+++ b/src/admin/App.vue
@@ -0,0 +1,4 @@
+
+ wp-admin
+
+
diff --git a/src/admin/README.md b/src/admin/README.md
new file mode 100644
index 0000000..965b49f
--- /dev/null
+++ b/src/admin/README.md
@@ -0,0 +1 @@
+# The admin's panel sub-project
diff --git a/src/admin/main.ts b/src/admin/main.ts
new file mode 100644
index 0000000..ef1099f
--- /dev/null
+++ b/src/admin/main.ts
@@ -0,0 +1,13 @@
+import { createApp } from 'vue'
+import { VueSvgIconPlugin } from '@yzfe/vue3-svgicon'
+import '@yzfe/svgicon/lib/svgicon.css'
+import App from './App.vue'
+import { storeProviderPlugin } from '@/hooks/store'
+// import { auth, init, posts, comments } from './store'
+import { intlPlugin } from '../locales'
+
+const app = createApp(App)
+// app.use(storeProviderPlugin, [auth, init, posts, comments])
+app.use(intlPlugin)
+app.use(VueSvgIconPlugin, { tagName: 'svg-icon' })
+app.mount('#app')
diff --git a/vite.config.ts b/vite.config.ts
index f586a86..319d360 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -29,21 +29,28 @@ export default defineConfig({
// host: '192.168.28.26',
host: 'localhost',
port: 9000,
- // path?: string,
- // timeout?: number,
- // overlay?: boolean
},
},
build: {
+ target: 'modules',
manifest: true,
sourcemap: true,
outDir: 'app/assets/dist',
chunkSizeWarningLimit: 2048,
- // lib: {
- // entry: path.resolve(__dirname, 'src/main.ts'),
- // name: 'sakura-next',
- // formats: ['umd'],
- // },
+ rollupOptions: {
+ // external: ['vue'],
+ input: {
+ main: path.resolve(__dirname, 'src/main.ts'),
+ admin: path.resolve(__dirname, 'src/admin/main.ts'),
+ },
+ output: {
+ // TODO: use ES5 bundle instead
+ // globals: {
+ // vue: 'Vue',
+ // },
+ // manualChunks: undefined,
+ },
+ },
},
css: {
preprocessorOptions: {
@@ -52,19 +59,4 @@ export default defineConfig({
},
},
},
- // optimizeDeps: {
- // exclude: ['@fortawesome/fontawesome-free'],
- // },
- // outputDir: path.resolve(__dirname, 'app/dist'),
- // publicPath: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:9000/',
- // configureWebpack: (config) => {
- // config.output.filename = process.env.NODE_ENV === 'production' ? 'sakura-app.[chunkhash].js' : 'sakura-app.js'
- // },
- // devServer: {
- // host: 'localhost',
- // port: 9000,
- // hot: true,
- // disableHostCheck: true,
- // headers: { 'Access-Control-Allow-Origin': '*' },
- // },
})