Skip to content

Commit

Permalink
fix: revert nextjs inytegration to local dir
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 15, 2021
1 parent f5005d9 commit 7c51f2a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion integrations/nextjs-plugin/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { config } from '../../rollup-config';

export default config({
input: ['./src/index.tsx', './src/build.ts'],
input: ['./src/index.tsx', './src/build.ts', './src/component-controls.ts'],
});
18 changes: 7 additions & 11 deletions integrations/nextjs-plugin/src/build.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import path from 'path';
import fs from 'fs';
import { BuildProps, RuleOptions } from '@component-controls/core';
import {
getCSSFilePath,
getDistFolder,
} from '@component-controls/core/node-utils';
import {
buildBundle,
webpackConfig,
} from '@component-controls/base-integration/webpack-build';
import { buildBundle } from '@component-controls/base-integration/webpack-build';

module.exports = ({
bundleName,
configPath,
presets,
staticFolder,
distFolder,
distFolder: userDistFolder,
webpack,
...rest
}: BuildProps) => () => {
const distFolder = getDistFolder({ distFolder: userDistFolder });
const buildOptions: BuildProps = {
bundleName,
configPath,
presets,
staticFolder,
distFolder,
distFolder: path.resolve(__dirname),
staticFolder: staticFolder || path.join(distFolder, 'static'),
webpack,
};
return {
Expand All @@ -48,15 +47,12 @@ module.exports = ({
const loader: any = config.module?.rules?.find(
(r: any) => (r?.use as any)?.loader === 'next-babel-loader',
);
if (loader) {
loader.exclude = [getDistFolder(buildOptions)];
}
if (loader?.options) {
(loader.options as any).babelPresetPlugins.push(
'@emotion/babel-plugin',
);
}
return webpackConfig({ config, options: buildOptions });
return config;
},

...rest,
Expand Down
3 changes: 3 additions & 0 deletions integrations/nextjs-plugin/src/component-controls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { LoadingStore } from '@component-controls/loader';
const bundle = {} as LoadingStore;
module.exports = bundle;
7 changes: 4 additions & 3 deletions integrations/nextjs-plugin/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { store } from '@component-controls/base-integration/store';
// import { Store, getDefaultStore } from '@component-controls/core';
import { Store } from '@component-controls/core';
import { loadStore } from '@component-controls/store';

// export const store: Store = getDefaultStore();
const bundle = require('./component-controls');
export const store: Store = loadStore(bundle, true);

0 comments on commit 7c51f2a

Please sign in to comment.